selenium - Dynamic xpath handling -


below xpath

driver.findelement(by.xpath("html/body/div[9]/div/a/div")).click(); 

in above code value of div[6] keep changing. will

driver.findelement(by.xpath("html/body/div[6]/div/a/div")).click(); or

driver.findelement(by.xpath("html/body/div[1]/div/a/div")).click(); 

please provide solution.

we faced issue dynamic page content making xpath identification useless. took decision make sure needed identified in test have id set. so:

driver.findelement(by.xpath("html/body/div[6]/div/a/div")).click();  

becomes:

driver.findelement(by.id("mydivid")).click();  

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -