php-webdriver -- A very thin wrapper of WebDriver
=================================================
## DESCRIPTION
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.
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
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.
The function's return value is exactly what is returned from the server as part of the protocol definition. If an error is returned, the function will throw the appropriate WebDriverException instance.
## GETTING STARTED
* All you need as the server for this client is the selenium-server-standalone-#.jar file provided here: http://code.google.com/p/selenium/downloads/list
* Download and run that file, replacing # with the current server version.
java -jar selenium-server-standalone-#.jar
* Then when you create a session, be sure to pass the url to where your server is running.
// This would be the url of the host running the server-standalone.jar
$wd_host = 'http://localhost:4444/wd/hub'; // this is the default
$web_driver = new WebDriver($wd_host);
// First param to session() is the 'browserName' (default = 'firefox')
// Second param is a JSON object of additional 'desiredCapabilities'
// POST /session
$session = $web_driver->session('firefox');
* See also [wiki page for launching different browsers](https://github.com/facebook/php-webdriver/wiki/Launching-Browsers).
## SIMPLE EXAMPLES
### Note that all of these match the Protocol exactly
* Move to a specific spot on the screen
// POST /session/:sessionId/moveto
$session->moveto(array('xoffset' => 3, 'yoffset' => 300));
* Get the current url
// GET /session/:sessionId/url
$session->url();
* Change focus to another frame
// POST /session/:sessionId/frame
$session->frame(array('id' => 'some_frame_id'));
* Get a list of window handles for all open windows
// GET /session/:sessionId/window_handles
$session->window_handles();
* Accept the currently displayed alert dialog
// POST /session/:sessionId/accept_alert
$session->accept_alert();
* Change asynchronous script timeout
// POST /session/:sessionId/timeouts/async_script
$session->timeouts()->async_script(array('ms' => 2000));
* Doubleclick an element on a touch screen
// POST session/:sessionId/touch/doubleclick
$session->touch()->doubleclick(array('element' => $element->getID())
* Check if two elements are equal
// GET /session/:sessionId/element/:id/equals/:other
$element->equals($other_element->getID()))
* Get value of a css property on element
// GET /session/:sessionId/element/:id/css/:propertyName
$element->css($property_name)
## 'GET', 'POST', or 'DELETE' to the same command examples
### When you can do multiple http methods for the same command, call the command directly for the 'GET', and prepend the http method for the 'POST' or 'DELETE'.
* Set landscape orientation with 'POST'
// POST /session/:sessionId/orientation
$session->postOrientation(array('orientation' => 'LANDSCAPE'));
* Get landscape orientation with normal 'GET'
// GET /session/:sessionId/orientation
$session->orientation();
* Set size of window that has $window_handle with 'POST'
// If excluded, $window_handle defaults to 'current'
// POST /session/:sessionId/window/:windowHandle/size
$session
->window($window_handle)
->postSize(array('width' => 10, 'height' => 10));
* Get current window size with 'GET'
// GET /session/:sessionId/window/:windowHandle/size
$session->window()->size();
## Some unavoidable exceptions to direct protocol translation.
* Opening pages
// POST /session/:sessionId/url
$session->open('http://www.facebook.com');
* Dealing with the session
// DELETE /session/:sessionId
$session->close();
// GET /session/:sessionId
$session->capabilities();
* To find elements
// POST /session/:sessionId/element
$element = $session->element($using, $value);
// POST /session/:sessionId/elements
$session->elements($using, $value);
// POST /session/:sessionId/element/:id/element
$element->element($using, $value);
// POST /session/:sessionId/element/:id/elements
$element->elements($using, $value);
* To get the active element
// POST /session/:sessionId/element/active
$session->activeElement();
* To manipulate cookies
// GET /session/:sessionId/cookie
$session->getAllCookies();
// POST /session/:sessionId/cookie
$session->setCookie($cookie_json);
// DELETE /session/:sessionId/cookie
$session->deleteAllCookies()
// DELETE /session/:sessionId/cookie/:name
$session->deleteCookie($name)
* To manipulate windows
// POST /session/:sessionId/window
$session->focusWindow($window_handle);
// DELETE /session/:sessionId/window
$session->deleteWindow();
### See also [wiki page of examples](https://github.com/facebook/php-webdriver/wiki/Example-command-reference).
没有合适的资源?快使用搜索试试~ 我知道了~
自用php+mysql内容管理系统(cms).zip
共814个文件
gif:319个
png:221个
js:93个
需积分: 5 0 下载量 96 浏览量
2024-01-19
10:39:56
上传
评论
收藏 4.47MB ZIP 举报
温馨提示
软件开发设计:PHP、QT、应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、IOS、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:数据集、包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
自用php+mysql内容管理系统(cms).zip (814个子文件)
UpLoad_Class.asp 15KB
file_manager_json.asp 6KB
JSON_2.0.4.asp 4KB
upload_json.asp 3KB
demo.asp 2KB
build.bat 435B
compress.bat 96B
all-ie.bat 47B
all-firefox.bat 35B
all-chrome.bat 34B
firebug.css 65KB
firebug.css 63KB
firebug.css 63KB
firebug.css 63KB
firebug.css 63KB
default.css 20KB
firebug-1.3a2.css 15KB
firebug-1.3a2.css 15KB
firebug-1.3a2.css 15KB
datepicker.css 5KB
datepicker.css 5KB
qunit.css 4KB
iconfont.css 4KB
datepicker.css 4KB
style.css 4KB
datepicker.css 3KB
qq.css 3KB
tab.css 3KB
simple.css 2KB
agate.css 1KB
default.css 1KB
github.css 1KB
prettify.css 960B
firebug.IE6.css 652B
firebug.IE6.css 652B
firebug.IE6.css 652B
WdatePicker.css 149B
WdatePicker.css 149B
iconfont.eot 21KB
static.gif 35KB
login_09.gif 22KB
login_04.gif 17KB
login_06.gif 14KB
35.gif 13KB
42.gif 13KB
welcome.gif 11KB
40.gif 10KB
18.gif 8KB
19.gif 8KB
11.gif 8KB
32.gif 7KB
49.gif 6KB
main_05.gif 6KB
复件 main_05.gif 6KB
29.gif 6KB
97.gif 5KB
65.gif 5KB
login_03.gif 5KB
31.gif 5KB
46.gif 5KB
57.gif 5KB
main_09.gif 5KB
45.gif 5KB
login_08.gif 5KB
8.gif 5KB
main_08.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
43.gif 4KB
33.gif 4KB
68.gif 4KB
26.gif 4KB
14.gif 4KB
7.gif 4KB
51.gif 4KB
10.gif 4KB
47.gif 4KB
72.gif 4KB
6.gif 3KB
94.gif 3KB
84.gif 3KB
41.gif 3KB
17.gif 3KB
9.gif 3KB
28.gif 3KB
shadow2.gif 3KB
shadow2.gif 3KB
shadow2.gif 3KB
shadow2.gif 3KB
shadow2.gif 3KB
50.gif 3KB
95.gif 3KB
22.gif 3KB
27.gif 3KB
67.gif 3KB
90.gif 3KB
no_pic.gif 3KB
共 814 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
妄北y
- 粉丝: 9649
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功