Saturday, 15 March 2014

java - Testing element order in Selenium Webdriver with Elemental strings -



java - Testing element order in Selenium Webdriver with Elemental strings -

to start of easily, want selenium webdriver check order of elements. our way of selecting elements done xpath identifiers.

check next html code:

<html> <body> <header> header </header> body <footer> footer </footer> </body> </html>

what want, using selenium java webdriver (and xpaths) check if indeed header comes first, , then footer.

header = driver.findelement(by.xpath("//header")) footer = driver.findelement(by.xpath("//footer"))

how can done?

you can phone call getlocation() element on webelement point showing containing top left-hand corner of element.

comparing values should give desired effect. user perspective,

from dom perspective can utilize more advanced xpath

e.g.

driver.findelement(by.xpath("//header")).findelement(by.xpath("./following-sibling::footer"));

java selenium xpath webdriver

No comments:

Post a Comment