Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access element using Watir and XPath

Tags:

xpath

watir

I have some HTML that looks like this:

<h1 id="header">Header</h1>

I would like to click it using Watir and XPath.

like image 800
Željko Filipin Avatar asked Sep 25 '09 10:09

Željko Filipin


1 Answers

After watir-webdriver 0.5.1 selecting random element with an xpath was updated to:

browser.element(:xpath => "//h1[@id='header']").click

thanks to: https://groups.google.com/forum/#!topic/watir-general/c6Orvy7Qalw

like image 102
akostadinov Avatar answered Nov 26 '22 18:11

akostadinov