in my script i need to include if and else statement,here is the code
if((element(by.model('trt_model')).all(by.tagName('option')).get(0).getText()).toEqual('Select Contract'))
{
element(by.model('trt_model')).get(1).click();
}
else
{
element(by.model('trt_model')).get(0).click();
}
if the expect condition fails , i want the script to execute the else part, but this is not working. when expect condition fails,the script is not executing the else part
kindly suggest how this can be resolved Thank you
I have simplified your code and pasted below. You can try this one. Please let me know if you face any error with below code. Hope it will work.
I don't know how long is your list, but it seems that you can simplify your code. How about use:
instead of whole
if
statement?