Skip to content
hekra01 edited this page Oct 30, 2014 · 18 revisions

WebDriverJS are the Javascript bindings to Selenium.
See https://code.google.com/p/selenium/wiki/WebDriverJs

Modifications to the original Selenium source

  • Removal of the limitations described here https://code.google.com/p/selenium/wiki/WebDriverJs#Caveats
    It is not necessary to have an existing session in order to use WebDriverJS
    If a session exists it is reused
    If no session exists, then a new one is created
  • Handling of the new Cisco Selenium commands

Usage

Get the files in the web directory:

Demo Application

Cisco WebDriverJS comes with an demo application (WebDriverJsDemo.html) wich can be used to perform manual testing. WDJS

The UI includes the following elements:

  • WebDriver url and port:
    Specifies the IP and port of the WebDriver

  • Web Page:
    Specifies the url to open. Can be empty, see GET

  • GET:
    Request the WebDriver to open the URL specified in the "Web Page" field.
    If "WebPage" is blank:
    If the WebDriver already has a session open then this session will be reused and the "WebPage" value updated
    otherwise a new session will be created and a new web view created with blank content Otherwise
    If the WebDriver already has a session open then this session will be reused and the "WebPage" value updated otherwise a new session will be created and a new web view created with the specified URL content

  • Source:
    See Remote Visualizer

  • Screenshot:
    Downloads a screenshot of the current WebDriver window

  • Logs:
    Downloads the specified WebDriver log ("browser", i.e JS console or "driver")

  • Find by:
    WDJS Looks up and element by id, name, tagname or xpath.
    If found, extra controls are displayed to interact with the element

  • A Keyboard

  • List window handles:
    Lists the window handles managed by the current session

  • Choose window:
    Switched the current window to the selected handle. The "WebPage" fiels is updated with the window URL This is useful when dealing with composite UIs (web in widgets, inner frames, etc...)

  • Set window size:
    Resizes the current window

  • Disable click events:
    Click events disabled in Visualizer. See Remote Visualizer

  • Quit:
    Quits the current session

Remote Visualizer

Clicking on the "Source" button above will popup a window that mirrors the current window

The interaction on the "visualization" popup will be forwarded to the actual WebDriver window

This can be used to perfrom interactive testing of gestures, mouse movements etc..

The WebDriver command is:

/session/:sessionId/-cisco-visualizer-source
GET /session/:sessionId/-cisco-visualizer-source
Get a deep copy of the current page source
URL Parameters: 
    :sessionId - ID of the session to route the command toReturns: The current page source. 
Potential Errors: 
    NoSuchWindow - If the currently selected window has been closed. 
        

It is also availble through org.openqa.selenium.qtwebkit.QtWebKitDriver.getVisualizerSource().

Clone this wiki locally