The page-object-gem and watir treat input elements of type "image" (ie <input type="image">
) as buttons.
The element should be located if you change your page object accessor to use button
:
button(:lookup1, :id => 'imgLookup1')
Note that then you can click the input using lookup1
instead lookup1_element.click
.
Here is a working example:
class MyPage
include PageObject
button(:lookup1, :id => 'imgLookup1')
end
browser = Watir::Browser.new
browser.goto("data:text/html,#{DATA.read}")
page = MyPage.new(browser)
page.lookup1
browser.close
__END__
<html>
<body>
<input src = "https://www.mylinkhere.com/lookup.gif" name = "myimage1" type = "image" id = "imgLookup1" onclick="alert();">
</body>
</html>