Thursday, May 21, 2015

Read dynamically changing objects value with webdriver using sibling

How to read a text value from dynamically changing object with webdriver

If you you the sibling text,

String actualDiscount=driver.findElement(By.xpath("//span[contains(text(), 'Sibling Text')]//following-sibling::span[1]")).getText();

From gthe above table, if you first name.
We can retrieve the Address like this

StringAddress =driver.findElement(By.xpath("//span[contains(text(), 'Bat')]//following-sibling::span[2]")).getText();


No comments:

Post a Comment