Source Allies Logo

Sharing Our Passion for Technology

& Continuous Learning

<   Back to Blog

Selenium IDE - Part II

In Part I we covered

  • Setting Up
  • Recording Tests
  • Playing Back Tests
  • Saving Test Cases
  • Resuming Recording
  • Saving Test Suites

All examples will use the sample site https://sites.google.com/site/example4selenium/.

Store Value

  • There are two ways to store values.
  • First, you can define custom variables
  • Second you can use the drop-down 'storeText' option.
  • Enter a variable name.
  • Variables can be used by simply surrounding the variable name with '${ }'
  • Running this script will result in an insert of both variables separated with an 'and'.

Debug

  • To debug a script insert a breakpoint.
  • Run the test case.
  • The button resumes the execution of the script.
  • The button steps through the test case one action at a time.

XPath

  • Selenium IDE can navigate html using XPath. If you are not familiar with XPath there is a beginners tutorial at https://www.w3schools.com/xml/xpath_intro.asp.
  • Instead of referring to the id of a target you can locate an element with XPath.
  • <li>You can verify your XPath by clicking the 'Find' button.  The element will be highlighted in the browser with flashing neon green if it exists.</li>
    <li>If you want to select elements by position, you may want the following information. The traditional '//input[2]' does not work all the time in Selenium IDE. If you can not locate your target element by index, use the following syntax '//input/following::input'. This syntax specifies the location of an input that follows another input. This will result in the selection of the second input. Simply add another '/following::' to get to the next matching element. Unfortunately this syntax is quite verbose.</li>
    

Exporting Scripts