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).
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
plainCms异步协程内容管理系统 v1.0.zip (1326个子文件)
make.bat 4KB
build.bat 435B
compress.bat 96B
all-ie.bat 47B
all-firefox.bat 35B
all-chrome.bat 34B
theme.conf 65B
bootstrap.css 144KB
bootstrap.min.css 120KB
firebug.css 65KB
firebug.css 63KB
firebug.css 63KB
firebug.css 63KB
firebug.css 63KB
DPlayer.min.css 44KB
ueditor.css 43KB
ueditor.min.css 34KB
style.css 34KB
doc.css 27KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
video-js.css 21KB
default.css 20KB
image.css 18KB
swiper.min.css 17KB
firebug-1.3a2.css 15KB
firebug-1.3a2.css 15KB
firebug-1.3a2.css 15KB
video.css 15KB
attachment.css 14KB
video-js.min.css 11KB
wap.css 9KB
style777.css 9KB
shCoreDefault.css 7KB
qunit.css 4KB
scrawl.css 4KB
datepicker.css 4KB
datepicker.css 3KB
admin.css 3KB
qq.css 3KB
codemirror.css 3KB
charts.css 3KB
uploadify.css 2KB
background.css 2KB
simple.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
dashboard.css 2KB
prettify.css 1KB
edittable.css 1KB
template.css 1KB
prettify.css 960B
firebug.IE6.css 652B
firebug.IE6.css 652B
firebug.IE6.css 652B
webuploader.css 515B
help.css 389B
WdatePicker.css 182B
iframe.css 41B
classy.css_t 4KB
glyphicons-halflings-regular.eot 20KB
vjs.eot 3KB
UEditorSnapscreen.exe 508KB
screenshots-wap.gif 72KB
wface.gif 49KB
jxface2.gif 40KB
static.gif 35KB
banner.gif 34KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
35.gif 13KB
42.gif 13KB
40.gif 10KB
cface.gif 8KB
18.gif 8KB
19.gif 8KB
11.gif 8KB
firebug_upload_json.gif 7KB
32.gif 7KB
49.gif 6KB
29.gif 6KB
97.gif 5KB
65.gif 5KB
31.gif 5KB
46.gif 5KB
57.gif 5KB
2weima.gif 5KB
45.gif 5KB
8.gif 5KB
shadow.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
shadow.gif 4KB
共 1326 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
小小姑娘很大
- 粉丝: 4052
- 资源: 2313
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
- 以下是一个简化的示例,它使用pygame库来模拟烟花动画的框架.txt
- Linux线程同步机制深度解析与实用指南.zip
- PTA题库C语言解题策略与实战.rar
- SVPWM控制技术的simulink建模与仿真【包括simulink模型,参考文献,操作步骤】
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功