Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Crosswalk WebDriver

iKevinHan edited this page Sep 23, 2014 · 9 revisions

Introduction

WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. Crosswalk WebDriver(CrosswalkDriver) is a standalone server which implements WebDriver's wire protocol for Crosswalk. Part of code is ported from ChromeDriver.

Please feel free to send an email to mailto:[email protected] or https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev if you have any questions, help with troubleshooting, and general discussion.

All code is currently in the open source crosswalk project. You can build it or download binary direct.This site hosts CrosswalkDriver documentation, issue tracking, and releases.

You can also download binary from https://github.com/crosswalk-project/crosswalk-web-driver/blob/master/bin/xwalkdriver.

For Linux xwalk:

(1) Build XwalkDriver by building the 'xwalkdriver' target and get an executable binary in the build folder named 'xwalkdriver'.

(2) Build 'xwalk' target, install it in "/opt/crosswalk" or working path of 'xwalkdriver'.

(3) Use following python instructions to do a basic test.

$ export PYTHONPATH=~/path/to/xwalkdriver/server:~/path/to/xwalkdriver/client
$ python
>>> import server
>>> import xwalkdriver
>>> cd_server = server.Server('/path/to/xwalkdriver/executable')
>>> driver = xwalkdriver.XwalkDriver(cd_server.GetUrl())
>>> driver.Load('http://www.google.com')
>>> driver.Quit()
>>> cd_server.Kill()

For Android xwalk:

(1) Build XwalkDriver by building the 'xwalkdriver' target and get an executable binary in the build folder named 'xwalkdriver'.

(2) Get Crosswalk for Android from Download page.

(3) Pakage your app by execute command

    python make_apk.py --manifest=YOUR_APP_PATH/manifest.json --enable-remote-debugging

(4) Install your apk to device.

(5) Install Selenium package by executing command

    pip install selenium

(6) Run xwalkdriver binary.

(7) Execute following commands to test:

$ python
>>> from selenium import webdriver
>>> capabilities = {
  'xwalkOptions': {
    'androidPackage': 'YOUR_PACKAGE_NAME',
    'androidActivity': '.YOUR_ACTIVITY_NAME',
  }
}
>>> driver = webdriver.Remote('http://localhost:9515', capabilities)
>>> driver.execute_script("alert('aaaa')")

For Tizen xwalk:

(1) Install and launch the xwalk as server mode on Tizen IVI:

su - app
systemctl --user status xwalk.service
xwalkctl -i /'path'/wrt-rtbin-tizen-tests.xpk

(2) Set remote debug port by insert "--remote-debugging-port='PORT'" into "/usr/lib/systemd/user/xwalk.service" on Tizen IVI and reboot the IVI device. Then use "systemctl --user status xwalk.service" check if the xwalk service started with remote debugging mode.

(3) Connect Tizen IVI and PC with sdb.

a). Run the follow command on Tizen IVI:

#systemd start sdbd_tcp

b). Run the follow command on PC:

$sdb connect tizen_ivi_ip
$sdb root on

(4) If Selenium package not installed on PC. Install Selenium package by executing command

    pip install selenium

(5) Run xwalkdriver binary on PC.

$./xwalkdriver --sdb-port=26099

(6) Execute following commands to test: Before start Python, make sure your PC environment has no porxy for localhost.

$ unset http_proxy
$ unset https_proxy
$ python
>>> from selenium import webdriver
>>> 
capabilities = {
  'xwalkOptions': {
    'tizenDebuggerAddress': '10.238.158.97:9222',
    'tizenAppId': 'xwalk.ihogjblnkegkonaaaddobhoncmdpbomi',
  }
}
>>> driver = webdriver.Remote('http://localhost:9515', capabilities)
>>> driver.title
>>> driver.save_screenshot("screenshottest.png")
>>> driver.quit()

Related Links

Clone this wiki locally