Pass Parameters To Selenium Script In Behave BDD framework

Tutorial​​ 12-​​ Pass parametrs to​​ Selenium​​ script​​ in Behave BDD

Welcome to the 12th article in Behave BDD series!

Pass parameters to selenium script

Let​​ us now see how to pass parameters to a selenium script.​​ 

Launch the below website

https://sso.teachable.com/secure/673/users/sign_in?reset_purchase_session=1​​ 

Enter credentials

Click ‘Login In’, the below page comes up

Let us inspect a section of this page, see below

We notice that this section is a header h4

So let us write our feature file​​ 

Below is corresponding step definition file which is self-explanatory. The highlighted method shows the usage of passing parameters to step. We have replaced “testuser1@gmail.com” with {userid} and “testuser1” with {pwd}

Let us run the feature. The website is launched and userid/pwd are entered, see below. The small robot at the top navigation bar means that the browser was launched by automation tool

 

The scenario passes

Let us see another example.

Launch​​ https://sso.teachable.com/secure/7106/users/sign_up?reset_purchase_session=1​​ 

We will fill up the below form and click ‘Sign Up’ button

Let us comment previous scenario, write another scenario

Below is corresponding step definition​​ file. The lines 16-21 show the usage of parameters


Save and run the feature. Notice that website launches, form is filled

 

The scenario passes, see below

So this is how we​​ pass parameters to​​ selenium​​ script using​​ behave​​ BDD.

Thank you for reading!

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 10000 RS/149 USD
Attend All Live courses in just 10000 rs / $149 - offer ends 31st May 2024