Regarding Cucumber feature file | Selenium Forum
Y
yedramiarun Posted on 21/09/2021

How to write if-else condition in a feature file?

For Ex: i have to click on a drop down and select an option based on the login Url.

 

i.e. search the text of the option on the url if similar text is found on the Url then 

select tht option.

can u please guide me how to write if-else in feature file using BDD

 

 


A
Ashish Thakur Replied on 23/09/2021

You can use combination of When Then And

When URL is similar

Then Search

When URL is Different

Then Click on button


Y
yedramiarun Replied on 27/09/2021

Thank you for your response. I have done the same way as mentioned above. But on the drop down options click is not happening i.e option is not selected

In a drop down there are 3 options --there are 3 urls each option resides on the url ...so i need to check the text of the option on the loggedin url and select the option belongs to the text.

i.e. When user try to check %url1% is in [applicationurl]  -----%url1%--->contains text which is part of the [applicationurl]

     Then I click on option1 control else I click on option2 control.

 

Please help me not able to check the conditions in feature file


Related Posts