[autotest] add a wrapper for client side chrome driver based test
client/common_lib/cros/chromedriver.py
|chromedriver| is a wrapper class for any client side test that wants to use
Chrome Driver to interact with the browser. The wrapper class handles log in
with Telemtry when an instance of chrome_driver is instantiated. It exposes a
property |driver| for test to call methods of Chrome Driver.
|chromedriver_server| is a wrapper class to start/stop chromedriver server in
remote mode. That is, ChromeOS logged in with debugging port opened using
Telemetry, Chrome Driver started by specifying the remote debug port of Chrome
browser.
client/site_tests/desktopui_UrlFetchWithChromeDriver
A sample test that use Chrome Driver/Selenium to test browser url and cookie.
This test takes following test as an example, which uses pyauto.
client/site_tests/desktopui_UrlFetch
related CL that adds Chrome Driver to test image:
https://chromium-review.googlesource.com/#/c/173183/
TODO(dshi)> another CL will be added to add desktopui_UrlFetchWithChromeDriver
to ebuild: chromeos-base/autotest-chrome/autotest-chrome-9999.ebuild
BUG=chromium:289702
TEST=test_that 172.22.75.225 desktopui_UrlFetchWithChromeDriver
trybot build: Tested in build trybot-lumpy-paladin/R32-4831.0.0-b1336
Change-Id: I8d3ec8a8bd3e14cdc4cc5d9c76f19a422ad0e00b
Reviewed-on: https://chromium-review.googlesource.com/172082
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
diff --git a/client/bin/site_utils.py b/client/bin/site_utils.py
index c14416c..7cc96af 100644
--- a/client/bin/site_utils.py
+++ b/client/bin/site_utils.py
@@ -1,3 +1,5 @@
+#pylint: disable-msg=C0111
+
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -91,6 +93,18 @@
return (pid, command_line)
+def get_chrome_remote_debugging_port():
+ """Returns remote debugging port for Chrome.
+
+ Parse chrome process's command line argument to get the remote debugging
+ port.
+ """
+ pid, command = get_oldest_by_name('chrome')
+ matches = re.search('--remote-debugging-port=([0-9]+)', command)
+ if matches:
+ return int(matches.group(1))
+
+
def get_process_list(name, command_line=None):
"""
Return the list of pid for matching process |name command_line|.
@@ -195,10 +209,10 @@
# command to the serial port.
proc = platform.processor()
if 'QEMU' in proc and os.path.exists('/dev/ttyUSB0'):
- logging.info('Saving VM state "%s"' % checkpoint)
+ logging.info('Saving VM state "%s"', checkpoint)
serial = open('/dev/ttyUSB0', 'w')
serial.write("savevm %s\r\n" % checkpoint)
- logging.info('Done saving VM state "%s"' % checkpoint)
+ logging.info('Done saving VM state "%s"', checkpoint)
def check_raw_dmesg(dmesg, message_level, whitelist):