|
1 | 1 | php-webdriver -- A very thin wrapper of WebDriver |
2 | 2 | ================================================= |
3 | 3 |
|
4 | | -## DESCRIPTION |
| 4 | +## DESCRIPTION |
5 | 5 |
|
6 | 6 | This client aims to be as thin as possible, abusing the dynamic nature of PHP to allow almost all API calls to be a direct transformation of what is defined in the WebDriver protocol itself. |
7 | 7 |
|
8 | 8 | Most clients require you to first read the protocol to see what's possible, then study the client itself to see how to call it. This hopes to eliminate the latter step, and invites you to rely almost exclusively on http://code.google.com/p/selenium/wiki/JsonWireProtocol |
9 | 9 |
|
10 | 10 | Each command is just the name of a function call, and each additional path is just another chained function call. The function parameter is then either an array() if the command takes JSON parameters, or an individual primitive if it takes a URL parameter. |
11 | 11 |
|
12 | | -## SIMPLE EXAMPLES |
| 12 | +## SIMPLE EXAMPLES |
13 | 13 |
|
14 | 14 | ### Note that all of these match the Protocol exactly |
15 | 15 |
|
16 | | -* Get a session (opens a new browser window) |
| 16 | +* Get a session (opens a new browser window) |
17 | 17 |
|
18 | | - $web_driver = new WebDriver(); // could pass a host besides localhost |
19 | | - $session = $web_driver->session(); // could pass a browser name |
| 18 | + $web_driver = new WebDriver(); // could pass a host besides localhost |
| 19 | + $session = $web_driver->session(); // could pass a browser name |
20 | 20 |
|
21 | | -* Move to a specific spot on the screen |
| 21 | +* Move to a specific spot on the screen |
22 | 22 |
|
23 | | - $session->moveto(array('xoffset' => 3, 'yoffset' => 300)); |
| 23 | + $session->moveto(array('xoffset' => 3, 'yoffset' => 300)); |
24 | 24 |
|
25 | | -* Change asynchronous script timeout |
| 25 | +* Change asynchronous script timeout |
26 | 26 |
|
27 | | - $session->timeouts()->async_script(array('ms' => 2000)); |
| 27 | + $session->timeouts()->async_script(array('ms' => 2000)); |
28 | 28 |
|
29 | | -* Touch screen |
| 29 | +* Touch screen |
30 | 30 |
|
31 | | - $session->touch()->scroll($element->getID()) |
| 31 | + $session->touch()->scroll($element->getID()) |
32 | 32 |
|
33 | | -* Check if two elements are equal |
| 33 | +* Check if two elements are equal |
34 | 34 |
|
35 | | - $element->equals($other_element->getID())) |
| 35 | + $element->equals($other_element->getID())) |
36 | 36 |
|
37 | | -* Get value of css property on element |
| 37 | +* Get value of css property on element |
38 | 38 |
|
39 | | - $element->css($property_name) |
| 39 | + $element->css($property_name) |
40 | 40 |
|
41 | 41 | ## 'GET', 'POST', or 'DELETE' to the same command examples |
42 | 42 |
|
43 | 43 | ### If you can do multiple http methods for the same command, such as 'orientation', where 'POST' changes the orientation but 'GET' fetches it, call the command directly for the getter, and prepend the http method for the writers. |
44 | 44 |
|
45 | | -* Set landscape orientation |
| 45 | +* Set landscape orientation |
46 | 46 |
|
47 | | - $session->postOrientation(array('orientation' => 'LANDSCAPE')); |
| 47 | + $session->postOrientation(array('orientation' => 'LANDSCAPE')); |
48 | 48 |
|
49 | | -* Get landscape orientation |
| 49 | +* Get landscape orientation |
50 | 50 |
|
51 | | - $session->orientation(); |
| 51 | + $session->orientation(); |
52 | 52 |
|
53 | 53 | ## A few Element/Cookie/Session/Window convenience exceptions. |
54 | 54 |
|
|
0 commit comments