Skip to content
hekra01 edited this page Jan 10, 2017 · 18 revisions

WebDriverJS are the Javascript bindings to Selenium.
The original source is here: https://code.google.com/p/selenium/wiki/WebDriverJs and was modified as below:

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:

  1. WebDriver url and port:
    Specifies the IP and port of the WebDriver
  2. Web Page:
    Specifies the url to open. Can be empty, see GET
  3. GET:
    Requests 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" field value updated with the WebDriver's current URL
      • Otherwise a new session will be created and a new web view created with blank content
    • Otherwise ("WebPage" field specifies and URL)
      • If the WebDriver already has a session open then this session will be reused and the URL loaded in the current view (web/widget/quick)
      • Otherwise a new session will be created and a new web view created with the specified URL content
  4. Visualize:
    See Remote Vizualizer
  5. Screenshot:
    Downloads a screenshot of the current WebDriver window
  6. Logs:
    Downloads the specified WebDriver log ("browser", i.e JS console or "driver")
  7. Find by:
    Looks up and element by id, name, tagname or xpath.
    If found, extra controls are displayed to interact with the element WDJS
  8. A Keyboard
  9. List window handles:
    Lists the window handles managed by the current session
  10. 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...)
  11. Set window size:
    Resizes the current window
  12. Disable click events:
    Click events disabled in Visualizer. See Remote Visualizer
  13. Quit:
    Quits the current session
  14. Source: Prints the page source the the text area

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().