Below is the html from webpage i am trying to automate, When I am using Watir, it is finding the element correctly but not with watir-webdriver.
<td width="87">
<input type="image" style="height: 34px; width: 83px; border-width: 0px;" src="/test/test/img/Order-Online-Form_18.gif" id="order1_Next1" name="$Next1">
</td>
I am using the below code:
require 'rubygems'
require 'watir'
browser = watir::Browser.new
browser.goto 'test.com'
test = @browser.td(:xpath,"//input[@id='order1_Next1']").exists?
puts test
When I am using watir, it returns true but If i am using watir-webdriver, it returns false.
Can you guys help me why watir-webdriver is not recognizing the xpath
Thanks
You’re trying to locate a ‘td’ when you’re looking for a ‘button’.
And using a XPath selector is almost certainly the wrong way to locate this element.
You’re much better off using the button element type with an id attribute:
You can use the last line if you’re adamant about xpath, but as you can see it’s more verbose and less clear to read.