Note : You can directly use xpaths in the IDE
example :
- Ide is best use to perform disposable fast and small repeataitve tasks .
- So basically we know Java Selenium does not come with record option like other automation tools so when you can use IDe to record steps and later export to Java / Python - TestNg/ Junit . And change the element locators value to required and use it in your code.
http://catchbug.blogspot.in/2013/11/selenium-ide-tips-and-crash-refs.html
http://catchbug.blogspot.in/2016/03/selenium-how-to-create-xpath.html
http://catchbug.blogspot.in/2015/09/selenium-using-firefox-inbuilt.html
Command
|
Number
of Parameters
|
Description
|
open
|
0
- 2
|
Opens a page using a URL.
|
click/clickAndWait
|
1
|
Clicks on a specified element.
|
type/typeKeys
|
2
|
Types a sequence of characters.
|
verifyTitle/assertTitle
|
1
|
Compares the actual page title
with an expected value.
|
verifyTextPresent
|
1
|
Checks if a certain text is found
within the page.
|
verifyElementPresent
|
1
|
Checks the presence of a certain
element.
|
verifyTable
|
2
|
Compares the contents of a table
with expected values.
|
waitForPageToLoad
|
1
|
Pauses execution until the page is
loaded completely.
|
waitForElementPresent
|
1
|
Pauses execution until the
specified element becomes present.
|
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_element
filter=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]
|
DOM
>getElementById
>getElementsByName
>dom:name
(applies
only to elements within a named form)
>dom:index
|
document.forms[index of the form].elements[index of the element]
document.getElementsByName("name")[index]
|
document.forms[0].elements[”phone”]
|
- Download this js file: https://github.com/darrenderidder/sideflow/blob/master/sideflow.js
- Launch Selenium IDE from Firefox and open the options menu.
- Upload the .js file to the "Selenium Core extensions (user-extensions.js)" field.
- Restart IDE
- Make sure u modify and add below commands depending on your requirement
New Test
|
||
Command
|
Target
|
Value
|
open
|
http://docs.seleniumhq.org/
|
|
setSpeed
|
1000
|
|
store
|
1
|
MyVar
|
while
|
storedVars.MyVar <= 3
|
|
echo
|
${MyVar}
|
|
highlight
|
css=img[alt="Selenium
Logo"]
|
|
store
|
javascript{storedVars.MyVar++;}
|
|
endWhile
|
Ref :
https://www.guru99.com/introduction-selenuim-ide.html
https://stackoverflow.com/questions/11033321/how-to-loop-tests-in-selenium-ide
https://www.guru99.com/first-selenium-test-script.html