dimanche 4 juin 2017

Protractor if ,else with (expect(condition))

in my script i need to include if and else statement,here is the code

`if(expect(element(by.model('trt_model').get(0).getText()).toEqual('example'))
{
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

Aucun commentaire:

Enregistrer un commentaire