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
Post a Comment