-
Notifications
You must be signed in to change notification settings - Fork 58
Build And Run
hekra01 edited this page Jul 1, 2016
·
58 revisions
- 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'
},
}
- 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 inout\wd.sln
that should then be built in msvc. - Note 2: QtWebDriver has no official support for Qt5.3+ yet. Build on 5.3 was succeded with update of icu lib
$ sudo apt-get install libicu52
$ ./build.sh ./out
# Set Qt environment
D:\test> D:\Qt\5.2.1\msvc2010_opengl\bin\qtenv2.bat vsvars
# Run WebDriver
D:\test> WebDriver.exe
# 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
In order to use QtWebDriver with your existing application:
- Make sure the QtWebDriver libraries and headers are available in your build environment
- headers: https://github.com/cisco-open-source/qtwebdriver/tree/WD_1.X_dev/inc
- libraries: build QtWebDriver from source or use the prebuilt libs from Releases
- Modify your application's
main
to configure and start QtWebDriver in the same process as theQApplication
. - For example see:
- main.cc: a basic example of an application using QtWebDriver
int main(int argc, char *argv[])
{
base::AtExitManager exit;
QApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false);
....
/* Start webdriver */
/* "wd_setup" is defined in Setup.cc, it configures the QtWebDriver */
int startError = wd_setup(argc, argv);
if (startError){
std::cout << "Error while starting server, errorCode " << startError << std::endl;
return startError;
}
setQtSettings();
return app.exec();
}
- Rebuild your application
- Run you application as usual. QtWebDriver will be started as well and listening on port
9517
by default - Then use Selenium or WebDriverJS to test your application
- See Command Line Switches for the command line arguments supported by QtWebDriver.
Home | Build And Run | Releases | Features
Copyright © 1992-2016 Cisco and/or its affiliates