WebDriver

From AutoIt Wiki
Revision as of 14:30, 27 December 2019 by Water (talk | contribs) (→‎Installation)
Jump to navigation Jump to search

This page is still a work in progress.

The W3C WebDriver API is a platform and language-neutral interface and wire protocol allowing programs or scripts to control the behavior of a web browser.

Introduction

WebDriver API

WebDriver enables developers to create automated tests that simulate user interaction. This is different from JavaScript unit tests because WebDriver has access to functionality and information that JavaScript running in the browser doesn't, and it can more accurately simulate user events or OS-level events. WebDriver can also manage testing across multiple windows, tabs and webpages in a single test session.

WebDriver UDF

The WebDriver UDF allows to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings.

Requirements

The following UDFs need to be installed - independant of the Browser you try to automate:

One of the following Drivers needs to be installed - depending on the Browser type and version you try to automate:

Browser Download Link Latest Version / Date Comments
Chrome Google 80.0.3987.16 / 2019.12.19 Follow this link to select the correct version depending on the Chrome version you run!
Edge Microsoft 81.0.370.0
FireFox github 0.26 / 2019.10.12 Firefox version ≥ 60 is recommended

Note: You must still have the Microsoft Visual Studio redistributable runtime installed on your system for the binary to run. This is a known bug which the authors weren't able fix for this release.

Internet Explorer Microsoft

Limitations

Not all WebDriver functions have been implemented by each browser. To check the status, click on the below link for each respective browser:

Big Picture

How the browser independant and browser dependant parts fit together:

Big Picture - How everything fits together

Installation

The following steps are needed to install everything you need to automate your browser:

  • Download the files listed in section "Requirements"
  • Move the UDFs to a directory where SciTE and Autoit can find them:
    • Json.au3 and BinaryCall.au3 from the JSON UDF
    • wd_Core.au3 and wd_helper.au3 from the WebDriver UDF
    • WinHttp.au3 and WinHttpConstants.au3 from the WinHttp UDF
  • Move the browser dependant WebDriver to the same directory:
    • chromedriver.exe for Chrome
    • geckodriver.exe for Firefox
    • xxx for Edge
  • Run the demo script to validate the installation

References

Further information sources: