Commit | Line | Data |
676409e6 |
1 | # (c) 2010 Matt S Trout (mst) |
2 | # same license as perl |
3 | # mail ideas, suggestions and flames to mst (at) shadowcat.co.uk |
4 | # proof of concept only |
5 | # no warranty, express or implied |
6 | # |
7 | # vnc4server :21 |
8 | # DISPLAY=:21 perl -MAlien::SeleniumRC -e 'Alien::SeleniumRC::start' |
9 | |
10 | use strict; |
11 | use warnings; |
12 | use Test::More qw(no_plan); |
13 | use Socialtext::WikiFixture::Selenese; |
14 | use HTML::TableExtract; |
15 | |
16 | # HTML ripped from http://seleniumhq.org/docs/05_selenium_rc.html#from-selense-to-a-program |
17 | |
18 | my $html = <<END; |
19 | <html> |
20 | <body> |
21 | <table border="1" class="docutils" id="google-search-example"> |
22 | <colgroup> |
23 | <col width="32%" /> |
24 | <col width="47%" /> |
25 | <col width="21%" /> |
26 | </colgroup> |
27 | <tbody valign="top"> |
28 | <tr><td>open</td> |
29 | <td>/</td> |
30 | |
31 | <td> </td> |
32 | </tr> |
33 | <tr><td>type</td> |
34 | <td>q</td> |
35 | <td>selenium rc</td> |
36 | </tr> |
37 | <tr><td>clickAndWait</td> |
38 | <td>btnG</td> |
39 | <td> </td> |
40 | </tr> |
41 | <tr><td>textLike</td> |
42 | |
43 | <td>Searches related to selenium rc</td> |
44 | <td> </td> |
45 | </tr> |
46 | </tbody> |
47 | </table> |
48 | </body> |
49 | </html> |
50 | END |
51 | |
52 | my $te = HTML::TableExtract->new; |
53 | |
54 | $te->parse($html); |
55 | |
56 | my $table = ($te->tables)[0]; |
57 | |
58 | my @rows = map { |
59 | [ map { $_ eq "\240" ? () : $_ } @$_ ] |
60 | } $table->rows; |
61 | |
62 | $ENV{selenium_browser} = '*firefox /usr/lib/iceweasel/firefox-bin'; |
63 | |
64 | my $wf = Socialtext::WikiFixture::Selenese->new( |
65 | host => 'localhost', |
66 | port => $< + 6900, |
67 | browser_url => 'http://www.google.com' |
68 | ); |
69 | |
70 | $wf->run_test_table(\@rows); |