tags:

views:

859

answers:

6

I have some HTML that looks like this:

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

I would like to click it using Watir and XPath.

+1  A: 
browser.element_by_xpath("//h1[@id='header']").click

Sources:

Željko Filipin
+1  A: 
browser.h1(:xpath, "//h1[@id='header']").click
Željko Filipin
A: 

Not using XPath, but it works:

browser.h1(:id, "header").click
Željko Filipin
A: 

Also not XPath, but works:

browser.h1(:html, /header/).click
Željko Filipin
A: 

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

both are correct usage of xpath

http://interviewpuzzle.blogspot.com

Sivaraaj
How is this answer adding value? You have just copied my answers.
Željko Filipin
A: 

Check with more abt watir in this forum

http://tszone.co.cc/forum/viewforum.php?f=19&amp;sid=cd08b444d523746a3b2ba036865a0eff

puzzle
This looks like spam to me. Watir already has a official google group.
Željko Filipin