As it is often referred online as "new selenium IDE 2019" lets sum up some tips how to use it. It can record your actions and put them in its UI, but you will often need to change it and refine it to get something useful.
Proper selectors, depending on your html output and classes/ids you might find they dont always work, for example in drupal forms "ids" change so what is once "id=edit-customer-profile-shipping-commerce-customer-address-und-0-locality" becomes "id=edit-customer-profile-shipping-commerce-customer-address-und-0-locality--2" and so on when using AJAX, so better way to target those forms is by "name" or "class", using name would be like
"name=customer_profile_shipping[commerce_customer_address][und][0][locality]".
Also use "pause" command when there is some AJAX action, I usually set value to 2000 so that selenium waits for ajax to refresh for 2 seconds.
When using text as selector, for example to click on some link, use command "click" and in target use "linkText=Log out" and with that Selenium will click on log out link and log out. To select plain text use css=tag:contains("inner text") in target field, for example
Executing script command is specially useful, I use it to get some value and then after that to have IF/END block, for example css=div:contains("User Name")
if (document.getElementsByClassName("form-item-account-login-mail").length != 0) { return true} else {return false}
will check length of this element and if it is not zero, will return "true", this line goes under target field, and under value you can put for example x as variable.
Then aftee that you add new command that is "IF" and in it target is just ${x} which will make IF check for ${x} variable and if it is true it will run that block (for example to check if user needs to login and if so, do loging in).
Better yet, you can just use something like this under target field:
return document.querySelector("body").classList.contains("not-logged-in")
which will return true/false or depending on your selector some value that you can then use in IF loop, under IF you can have expression like
${x} >= 1
You can also make tests that can be used in other tests, you use them with "run" command and set as a target name of test. Problem with this is that if they are test that are not standalone they will be run anyway when you go to button "run all tests" so this will pollute your testing a bit.
Some additional tips, select radio button with "name=stadiumType value=football" and for everything missed above, check table below.
Method |
Target Syntax |
Example |
---|---|---|
By ID | id= id_of_the_element | id=email |
By Name | name=name_of_the_element | name=userName |
By Name Using Filters | name=name_of_the_elementfilter=value_of_filter | name=tripType value=oneway |
By Link Text | link=link_text | link=REGISTER |
Tag and ID | css=tag#id | css=input#email |
Tag and Class | css=tag.class | css=input.inputtext |
Tag and Attribute | css=tag[attribute=value] | css=input[name=lastName] |
Tag, Class, and Attribute | css=tag.class[attribute=value] | css=input.inputtext[tabindex=1] |