Code Monkey home page Code Monkey logo

php-webdriver's Introduction

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.

SIMPLE EXAMPLES

Note that all of these match the Protocol exactly

  • Get a session (opens a new browser window)

    $web_driver = new WebDriver(); // could pass a host besides localhost

    $session = $web_driver->session(); // could pass a browser name

  • Move to a specific spot on the screen

    $session->moveto(array('xoffset' => 3, 'yoffset' => 300));

  • Change asynchronous script timeout

    $session->timeouts()->async_script(array('ms' => 2000));

  • Touch screen

    $session->touch()->scroll($element->getID())

  • Check if two elements are equal

    $element->equals($other_element->getID()))

  • Get value of css property on element

    $element->css($property_name)

'GET', 'POST', or 'DELETE' to the same command examples

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.

  • Set landscape orientation

    $session->postOrientation(array('orientation' => 'LANDSCAPE'));

  • Get landscape orientation

    $session->orientation();

A few Element/Cookie/Session convenience exceptions.

  • To find elements, use element($using, $value) and elements($using, $value), where $using is the locator strategy ('xpath', 'id', 'name', etc)
  • Use getAllCookies(), setCookie($cookie_json), deleteAllCookies(), and deleteCookie($name)
  • Visit pages with open(), close the browser window with close()

php-webdriver's People

Contributors

jubishop avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.