Reputation: 1
So element_by_xpath has been removed from watir webdriver and I am wondering if there is something similar to this still in existence. Basically there is a path element (pie chart) that is clickable and I need to have a regression test set up to for it. The people who designed the website apparently thought it would be cool to have everything inside this thing to be custom tags and there is nothing supported by watir webdriver that I can point to, at least to my knowledge.
Upvotes: 0
Views: 241
Reputation: 46826
element_by_xpath
was replaced with an :xpath locator, which is used like any other locator such as :text.
For example, say you have a custom 'asdf' element in your html:
<html>
<body>
<asdf>text</asdf>
</body>
</html>
Then you could locate the element via xpath like:
browser.element(:xpath => '//asdf').text
#=> "text"
The usual suggestion is to avoid xpath. If you are only using the xpath because of the tag name, you can use the :tag_name locator instead:
browser.element(:tag_name => 'asdf').text
#=> "text"
Upvotes: 2