Selenium IDE "open"and "openWindow" commands with example
"open" Command
"Open" command in selenium IDE is mostly used command in selenium IDE. "Open" command opens the URL whatever you want to open in your current selected browser window or tab.
In bellow given sample script, it will open "https://www.google.com" URL into your currently selected browser window.
"Open" command in selenium IDE is mostly used command in selenium IDE. "Open" command opens the URL whatever you want to open in your current selected browser window or tab.
In bellow given sample script, it will open "https://www.google.com" URL into your currently selected browser window.
New Test | ||
Command | Target | Value |
open | https://www.google.com |
"openWindow" Command
"openWindow" is useful to open your URL in new window. If you have not entered URL in target, It will
open just blank window.
In bellow given example, "openWindow" command will open "https://www.yahoo.com" in new browser tab. Please note, it firefox has blocked popup window then selenium IDE will show you error. In this case please allow browser to open popups.
New Test | ||
Command | Target | Value |
open | https://www.google.com | |
openWindow | https://www.yahoo.com | My_ID |
Try both these example by your self to understand it better. You can try it for your software web application for better exercise.
"click" and "clickAndWait" commands with example in selenium IDE
"click" command"click" command is another mostly used command in selenium ide. you can use it when you want to click on any element like Link, Text box, radio button, check box etc of your software web application.
In below given example, click command will click on element "css=#gb_2 > span.gbts" if it is present on page otherwise it will display error message in selenium IDE.
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
click | css=#gb_2 > span.gbts |
"clickAndWait" Command
"clickAndWait" command is some different than "click" command. It will wait for page to load means next command will be not executed until page not loaded successfully. You need to use this command when your
are clicking somewhere on page of software web application and page start reloading content.
In below given sample script, clickAndWait command will click on "css=#gb_2 > span.gbts" and wait for page to load successfully.
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
clickAndWait | css=#gb_2 > span.gbts |
"clickAt" and "clickAtAndWait" commands with example in selenium IDE
"clickAt" selenium IDE command
"clickAt" command is useful when you need to click on specific x,y
position of any element. Sometime this types of conditions occurs at
that time you can use clickAt command. You need to fill x,y position
value in value field of command.
In bellow example, It will click at 10,10 position on element "css=#gb_2 > span.gbts".
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
clickAt | css=#gb_2 > span.gbts | 10,10 |
You can use "clickAt" command when "click" command not working. I have seen many times where "click"
command not worked for me but worked "clickAt" command.
"clickAtAndWait" selenium IDE command
"clickAtAndWait" command is used when you want selenium wait to execute next command till page loaded successfully. It will click at specified coordinates of element.
In bellow given example, After clicking at element "css=#gb_2 > span.gbts", selenium IDE will wait for loading page successfully. Once page loaded successfully, it will click on "css=#gb_23 > span.gbts".
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
clickAtAndWait | css=#gb_2 > span.gbts | 50,50 |
click | css=#gb_23 > span.gbts |
"store" and "echo" command in selenium IDE
"store" command
"store" command is useful to store value or string into variable. When
you want to use some value at some other command, you can store that
value.
Bellow is the example of "store" command. It will store string "Hello" into variable "i". I can use that string in
any next commands.
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
store | Hello | i |
"echo" command
"echo" command is useful to know stored value of any variable. We can use it for debugging purpose.
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
store | Hello | i |
echo | ${i} |
In above example when "echo" command will be executed, it will display current store value of variable "i" into Log area of selenium IDE window. In this case it will show log like "[info] echo: Hello "..
"storeText" and "storeTextPresent" command in selenium IDE
"storeText" command
"storeText" command is useful to store text value of page element in to variable for future use.
See bellow given example. In this example, When "storeText" command will
be executed, value of page element "css=#gb_2 > span.gbts" will be
stored into variable "k". If specified target element ("css=b" in this
case) will be not found on page then it will show error message like
"[error] Element css=b not found" in log area of selenium IDE window.
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
storeText | css=#gb_2 > span.gbts | k |
echo | ${k} |
"storeTextPresent" command
"storeTextPresent" command is not for storing value of any target element, but it is useful to verify that
specified target text is available on page or not.
specified target text is available on page or not.
New Test | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
storeTextPresent | Images | j |
echo | ${j} |
No comments:
Post a Comment