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

Build

  • Required tools:
    • Python 2.7.2+
    • Qt 4.8.2+ or Qt 5.x

Example build in Ubuntu 14.04:

  • Install dependencies:
    $ sudo apt-get install g++ gyp
  • Clone QtWebdriver
$ git clone https://github.com/cisco-open-source/qtwebdriver
$ cd qtwebdriver
  • Create a configuration file wd.gypi, e.g:
# copy wd_common.gypi then edit it and adjust paths 
$ cp wd_common.gypi wd.gypi
$ vi
# ...edit, e.g: 
$ cat wd.gypi
{
'variables': {
    'QT5': '1', # change to '0' to disable Qt5
    'WD_CONFIG_QWIDGET_BASE': '1', # 1 to support widget or hybrid web
    'WD_CONFIG_WEBKIT': '1', #1 to support Web views
    'WD_CONFIG_QUICK': '1', #1 to support QML
    'WD_BUILD_MONGOOSE': '1', #1 to inline mongoose code in WebDriver libraries. Leave as is.
    'WD_CONFIG_PLAYER': '0', #For Qt5 only. If the Qt build includes QtMultimedia, then setting this field to 1 will enable to driving QMediaPlayer. See https://github.com/cisco-open-source/qtwebdriver/wiki/Media-Commands
    'WD_CONFIG_ONE_KEYRELEASE': '0', # Set to 0 (default). On long key press WD will send as many key release as key press. If set to 1 only the final key release is sent
    'QT_INC_PATH': '/home/user/Qt/5.2.0/gcc_64/include',
    'QT_BIN_PATH': '/home/user/Qt/5.2.0/gcc_64/bin',
    'QT_LIB_PATH': '/home/user/Qt/5.2.0/gcc_64/lib'
 },
}

Note: In Qt versions >= 5.6, QtWebkit and QWebView have been removed, so WD_CONFIG_WEBKITshould be set to 0 in order to build. QtWebdriver only supports QtWidget and QML for such versions.

Sample configuration files here, for Qt5 and Qt4

  • Build:
$ ./build.sh ./out

# The binaries are here:
# The WebDriver binary can automate QtWebkit, Qwidget, QML applications
$ ls -l  out/bin/desktop/release/WebDriver

# The WebDriver_noWebkit is the same, except without QtWebkit support.
$ ls -l  out/bin/desktop/release/WebDriver_noWebkit
  • Note 1: on Windows, build.bat will create a msvc project in out\wd.sln that should then be built in msvc.
  • Note 2: QtWebDriver is not supported on QT versions >= 5.6, in which QtWebkit views are removed.
  • Note 3: For webdriver support on QWebEngine, use the ChromeDriver included in QWebEngine.

Run

To run the prebuilt binaries

On Windows
# Set Qt environment, for Qt5
D:\test> D:\Qt\5.2.1\msvc2010_opengl\bin\qtenv2.bat vsvars
# Or for Qt4
D:\Qt\4.8.6\bin\qtvars.bat vsvars

# Then run WebDriver
D:\test> WebDriver.exe
On Linux
# Set Qt environment
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/Qt/5.2.0/gcc_64/lib

# Run WebDriver
$ cd WebDriver-linux64-Qt5.2.0-cisco-cmt-1.3.0/bin/
$ ./WebDriver

By default QtWebdriver starts on port 9517. To change this or use more options see Command Line Switches.

Once QtWebdriver is started, use a Selenium client to connect to it and automate Qt applications.

See Releases to download the pre-built exes

To build and run your own binary

See [Use QtWebDriver to run your application](Use QtWebDriver to run your application)

Clone this wiki locally