Is there a way to make actions optional in the Selenium IDE?

This is a little newbie question, but ... is there a way to make actions optional in the Selenium IDE? I will give an example of use.

In the application I'm testing, users see at the beginning of each session β€œhey, you agree with ToS by logging in” as a modal window. They must click "OK" to continue, and they do not see the window until the next session.

Based on what I have seen so far, I need to have one test set for the first test every day, and a second set of tests for everyone else. The second set is exactly the same, except that it does not have a β€œclick” OK button to cancel the initial modal window. Alternatively, I could just remember that my first run of the test every day will fail and that I should run the test again.

Both of these "decisions" seem unnecessarily uncomfortable. Can I just make the command an clickoption?

+3
source share
6 answers

Perhaps overdue, but for future search engines.

In the IDE, you can use if and endIf statements .

+3
source

javascript user-extensions.js . " Selenium IDE" user-extensions.js, Selenium, TryClick, , Click, .

Selenium.prototype.doTryClick = function(locator) {
    try {
        return Selenium.prototype.doClick.call(this,locator);
    } catch(err) { return null; }   
};
+3

cookie, , ToS, , cookie , , .

IDE , , , . , HTML.

HTML, Selenium IDE Flow Control , , . , , if. verifyCookie, , cookie.

, .

+1

aj.esler, Selenium ID - , . Firefox gotoif, , . 1, label = jump , , , = jump. enter image description here

+1

IDE - SelBlocks

: if/else/for/foreach/while XML .

0

http://wiki.openqa.org/display/SEL/flowControl . - :

1.storeElementPresent | //button[@name="cookie_law_accept"] | cookie_law
2.goToIf | storedVars['cookie_law']!=true | end
3.click | //button[@name="cookie_law_accept"]
4.label | end

Explain: 1. If an element is present, it will be saved as a cookie_law with the value true, 2. If the cookie_law is not true, go to the end label, go to the next step in another way 3. Press the cookie accept button (only when you senter the code is present because it itnot here - you go to the "end" label and you skip this command) 4. You go here if there is no cookie button :)

0
source

Source: https://habr.com/ru/post/1792064/


All Articles