How to write Dynamic XPath in Selenium

Hi All,

Welcome to Selenium tutorial, today we will see how to write Dynamic Xpath in Selenium because we can’t go ahead without xpath in details.`

We have two awesome plugins,which actually help you write xpath. Please check out below two plugin

Firefox Plugin XPath Generating tool

Chrome XPath Plugin  

Once you are done with xpath I will highly recommend you to visit Dynamic CSS as well which is highly used in Cross-browser Testing as well.

 

Here is the Youtube video for Dynamic XPath

 

 

 

Relative XPath method

 

Using single attribute

And so on.

Dynamic XPath in Selenium

Using multiple attribute

 

XPath in Selenium1

 

And so on.

 

Using contains method

And so on.

Dynamic Xpath in Selenium

Using starts-with method

Dynamic XPath in Selenium

 

Using Following node

 Dynamic Xpath in Selenium

Using preceding node

Dynamic Xpath in Selenium

Absolute XPath method

1-/html/head/body/div/input

 

Absolute-xpath

Absolute-xpath1

Relative and Absolute XPath method

 

Hope you are comfortable with xpath now. Please start writing xpath from your side and let me know if you are facing any issue.

 

For More updates Learn Automation page

For any query join Selenium group- Selenium Group

 

128 Comments

  1. aridevi
  2. Ravi Gavkare
  3. Sandeep Rapaka
  4. Kevin R. Mariano
  5. Aklakh Ahmad
  6. Ankit Nigam
  7. Vikas
  8. Devi
  9. sangeeta
    • sangeeta