Created
April 19, 2011 21:43
-
-
Save jarib/929779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'watir-webdriver' | |
path = File.expand_path "test.html" | |
File.open(path, "w") { |io| io << DATA.read } | |
begin | |
b = Watir::Browser.new | |
b.goto "file://#{path}" | |
first_row = b.table(:class => "sortable")[0] | |
p first_row.text | |
wanted_row = b.tr(:id => "account_1") | |
wanted_row.click | |
ensure | |
sleep 2 | |
b.close | |
end | |
__END__ | |
<html> | |
<head><title>Test</title></head> | |
<body> | |
<table class="sortable"> | |
<thead> | |
<tr id=""> | |
<th> </th> | |
<th class="sort" > Name </th> | |
<th class="sort" > Number </th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr id="account_1" onclick="alert('foo')"> | |
<td></td> | |
<td class="sortTd">Test Account</td> | |
<td class="sortTd">1</td> | |
</tr> | |
</tbody> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment