mardi 27 novembre 2018

Protractor - Jasmine . Perform some action only when a specific element is present.

I have a window-box with two buttons 'add' and 'close'. I need to test below scenario: When clicked on 'add' button it throws error and the window remains open. I need to click on 'close' button to proceed.

I used below code:

if(element(by.xpath("xpath_of_error_box")).isEnabled()) 
    {   
        element(by.xpath("xpath_of_close_button")).click();
    }

But it throws below error:

No element found using locator: By(xpath, xpath_of_error_box)

Is there any way to handle this?

Aucun commentaire:

Enregistrer un commentaire