Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CommandDescriptionExample
CommandTargetValue
storeThe Selenium functions store, storeValue, and storeText store some data for later access. Selenium uses a map called storedVars to store the data. You can use previously stored variables. ${varaiable_name} gives us access to the storedVars map. To display the value of a stored variable use "echo".storeJohnfirstName
commentAdds a commentcommentMy comment here
openThe "Open" command opens the URL in the current selected browser tab. The open command takes a full URL as input (recommended) or a path relative to the baseurl (outdated).openhttp://www.google.com/
typeTYPE sets the value of an input field, as though you typed it in. typeid=sq_101i${firstName}
click

clickAndWait and click send a Javascript click event to the DOM element defined by the locator.

The difference between clickAndWait and click is that clickAndWait waits for a page load event after the click. So clickAndWait = click + waitForPageToLoad.

clickxpath=//div[2]/div/div/a
select

The purpose of select and selectAndWait is to select a value from drop down/combo box or list box.

selectxpath=//*[@id="sq_102"]/div[2]/div[2]/div/div[2]/selectlabel=${birthMonth}
executeScript

The executeScript command executes a snippet of JavaScript in the context of the currently selected frame or window. The script fragment will be executed as the body of an anonymous function. To store the return value, use the 'return' keyword and provide a variable name in the value input field.

executeScriptreturn Number (${i}) + 1;i
Play an audio file.executeScriptvar audio = new Audio("https://www.myinstants.com/media/sounds/jeopardy.mp3"); audio.play();
executeScript_SandboxThe executeScript_Sandbox works exactly as executeScript but runs the Javascript in a sandbox. In other words, the code runs not in the website. The advantage of using the sandbox is that the website can not influence or block the Javascript execution. So unless you want to access elements of the website, better use the sandbox. The flow control commands (if_v2, while_v2, GotoIf_v2) use executeScript_Sandbox internally to evaluate the expression.executeScript_Sandboxreturn Number (${i}) + 1;i

do

...

repeatIf

The part between Do and Repeat If (expression) is executed as long as the expression is true. RepeatIf uses executeScript_Sandbox to evaluate the expression. If the expression is false, the IDE executes the immediate next command Repeat If.do

executeScriptreturn document.body.innerHTML.search("At this time there are no appointment slots available");textLocation
repeatIf${textLocation} != -1

if_v2

...

elseif

...

else

...

end

if statementif_v2${i} == 0
click ...
elseif${i}==1
click...
else

click...
end

while_v2

...

end


while_v2${i} < 4
executeScript_Sandboxreturn Number (${i}) + 1;i
click...
end

breakThe break statement breaks the loop and continues executing the code after the loop (if any). Usually it is used after a conditional "if" (or similar) statement.while_v2${i} < 4
...

  if_v2${i} == 3
    break

  end

end

...