[autotest] ignore import error from selenium
Ignore import error, as this can happen when builder tries to call the setup
method of test that imports chromedriver.
BUG=None
TEST=None
Change-Id: Icf60e05cba11031746030cd6ce50e7d5cf31eda1
Reviewed-on: https://chromium-review.googlesource.com/177341
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
diff --git a/client/common_lib/cros/chromedriver.py b/client/common_lib/cros/chromedriver.py
index 00c9891..f731b61 100644
--- a/client/common_lib/cros/chromedriver.py
+++ b/client/common_lib/cros/chromedriver.py
@@ -7,7 +7,13 @@
import os
import urllib2
-from selenium import webdriver
+try:
+ from selenium import webdriver
+except ImportError:
+ # Ignore import error, as this can happen when builder tries to call the
+ # setup method of test that imports chromedriver.
+ logging.error('selenium module failed to be imported.')
+ pass
import common
from autotest_lib.client.bin import utils
@@ -39,8 +45,12 @@
utils.get_chrome_remote_debugging_port())}
capabilities = {'chromeOptions':chromeOptions}
# Handle to chromedriver, for chrome automation.
- self.driver = webdriver.Remote(command_executor=self._server.url,
- desired_capabilities=capabilities)
+ try:
+ self.driver = webdriver.Remote(command_executor=self._server.url,
+ desired_capabilities=capabilities)
+ except NameError:
+ logging.error('selenium module failed to be imported.')
+ raise
def __enter__(self):