… | |
… | |
15 | |
15 | |
16 | # create a new session with default capabilities. |
16 | # create a new session with default capabilities. |
17 | $wd->new_session ({}); |
17 | $wd->new_session ({}); |
18 | |
18 | |
19 | $wd->navigate_to ("https://duckduckgo.com/html"); |
19 | $wd->navigate_to ("https://duckduckgo.com/html"); |
20 | my $searchbox = $wd->find_element ("css selector" => 'input[type="text"]'); |
20 | my $searchbox = $wd->find_element (css => 'input[type="text"]'); |
21 | |
21 | |
22 | $wd->element_send_keys ($searchbox => "free software"); |
22 | $wd->element_send_keys ($searchbox => "free software"); |
23 | $wd->element_click ($wd->find_element ("css selector" => 'input[type="submit"]')); |
23 | $wd->element_click ($wd->find_element (css => 'input[type="submit"]')); |
24 | |
24 | |
25 | # session gets autodeleted by default, so wait a bit |
25 | # session gets autodeleted by default, so wait a bit |
26 | sleep 10; |
26 | sleep 10; |
|
|
27 | |
|
|
28 | # this is an example of an action sequence |
|
|
29 | $wd->actions |
|
|
30 | ->move ($wd->find_element (...), 40, 5) |
|
|
31 | ->click |
|
|
32 | ->pause # to separate the click from the keypress |
|
|
33 | ->type ("some text") |
|
|
34 | ->key ("{Enter}") |
|
|
35 | ->perform; |
27 | |
36 | |
28 | =head1 DESCRIPTION |
37 | =head1 DESCRIPTION |
29 | |
38 | |
30 | WARNING: THE API IS NOT GUARANTEED TO BE STABLE UNTIL VERSION 1.0. |
39 | WARNING: THE API IS NOT GUARANTEED TO BE STABLE UNTIL VERSION 1.0. |
31 | |
40 | |
… | |
… | |
35 | |
44 | |
36 | At the time of this writing, it was so brand new that I could only get |
45 | At the time of this writing, it was so brand new that I could only get |
37 | C<geckodriver> (For Firefox) to work, but that is expected to be fixed |
46 | C<geckodriver> (For Firefox) to work, but that is expected to be fixed |
38 | very soon indeed. |
47 | very soon indeed. |
39 | |
48 | |
|
|
49 | One of the design goals of this module was to stay very close to the |
|
|
50 | language and words used in the WebDriver specification itself, so to make |
40 | To make most of this module, or, in fact, to make any reasonable use of |
51 | most of this module, or, in fact, to make any reasonable use of this |
41 | this module, you would need to refer to the W3C WebDriver recommendation, |
52 | module, you would need to refer to the W3C WebDriver recommendation, which |
42 | which can be found L<here|https://www.w3.org/TR/webdriver1/>: |
53 | can be found L<here|https://www.w3.org/TR/webdriver1/>: |
43 | |
54 | |
44 | https://www.w3.org/TR/webdriver1/ |
55 | https://www.w3.org/TR/webdriver1/ |
45 | |
56 | |
46 | =head2 CONVENTIONS |
57 | =head2 CONVENTIONS |
47 | |
58 | |