Inline XPaths

Inline XPaths allow you to enter own own XPath in a step without having to create a web locator which gives you the option to create test cases faster. However if you are planning on interacting with elements in several test cases where these elements could potentially change and would require maintenance, it’s best to use web locators as changing the XPath in one web locator automatically takes effect in all other test cases, while changing Inline XPath steps only applies to the step in which this change is made.

Similar to Web Locators, Inline XPaths support using variables. For example, if you create a step with Set_Var, the variable from this step can be used in any step with an Inline XPath. A collision may occur if your variable name is used in the XPath and this could cause some failures. For example, if you use //a[@id='test'], the ID in this XPath is an attribute in the DOM but the platform will look for a variable name with “ID” and if available, then this XPath changes and may cause failures. To avoid this, please make sure to use different variable names.

 

Inline XPaths are supported in the following commands:

  1. Check

  2. Clear

  3. Click

  4. Double_Click

  5. Drag_And_Drop

  6. Execute_Javascript

  7. File_Upload

  8. Fill

  9. Get_Web_Value

  10. Hotkeys

  11. Hover

  12. Hover_And_Click

  13. Multi_Action

  14. Right_Click

  15. Screenshot

  16. Scroll_To

  17. Scroll_To_Dynamic

  18. Select

  19. Submit

  20. Verify_Element

  21. Verify_Text

  22. Verify_Text_in_PDF

 

How to Use Inline XPaths

 

  1. To use Inline XPaths, simply bring up one of the commands above in your test case

  2. Select “XPath” from the dropdown list and enter your XPath in the textbox next to the dropdown list.

  3. You can run this test to make sure that this element is interacted with, in this case it will be clicked.

  4. You can also convert this step from Click to another command by clicking the dropdown list highlighted below and selecting which new command to use

  5. Once your selection is made, click Apply

  6. Check your new command to ensure no information is missing. For example, if you choose Get_Web_Value, you will need to enter a variable name and possibly change the Type depending on your scenario

Converting Inline XPaths to Web Locators

  1. In order to convert an inline XPath to a web locator, click on the Right Arrow next to XPath field

  2. You will be prompted to use the recently used page name and frame information. If you do not wish to use them, click No.

  3. Enter the required information (Web Page, Type and Alias) and save your web locator

     

  4. After saving, you will notice that Locator option was automatically picked and the web locator you created has been selected: