Unreviewed. Update Selenium WebDriver imported tests.
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2018 08:40:26 +0000 (08:40 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2018 08:40:26 +0000 (08:40 +0000)
* imported/selenium/importer.json:
* imported/selenium/py/selenium/__init__.py:
* imported/selenium/py/selenium/common/exceptions.py:
* imported/selenium/py/selenium/webdriver/__init__.py:
* imported/selenium/py/selenium/webdriver/remote/webelement.py:
* imported/selenium/py/selenium/webdriver/safari/webdriver.py:
* imported/selenium/py/test/selenium/webdriver/common/select_class_tests.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebDriverTests/ChangeLog
WebDriverTests/imported/selenium/importer.json
WebDriverTests/imported/selenium/py/selenium/__init__.py
WebDriverTests/imported/selenium/py/selenium/common/exceptions.py
WebDriverTests/imported/selenium/py/selenium/webdriver/__init__.py
WebDriverTests/imported/selenium/py/selenium/webdriver/remote/webelement.py
WebDriverTests/imported/selenium/py/selenium/webdriver/safari/webdriver.py
WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/select_class_tests.py

index 5dd8593..ca8ec9c 100644 (file)
@@ -1,3 +1,15 @@
+2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Unreviewed. Update Selenium WebDriver imported tests.
+
+        * imported/selenium/importer.json:
+        * imported/selenium/py/selenium/__init__.py:
+        * imported/selenium/py/selenium/common/exceptions.py:
+        * imported/selenium/py/selenium/webdriver/__init__.py:
+        * imported/selenium/py/selenium/webdriver/remote/webelement.py:
+        * imported/selenium/py/selenium/webdriver/safari/webdriver.py:
+        * imported/selenium/py/test/selenium/webdriver/common/select_class_tests.py:
+
 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed gardening. Skip new action tests added in r229166.
index f6177c4..192b313 100644 (file)
@@ -1,6 +1,6 @@
 {
     "repository": "https://github.com/SeleniumHQ/selenium.git",
-    "revision": "63d571a2d64a8930c171fe94fc7b2e7e4eefde87",
+    "revision": "300cd3fa0288d3a88eb4b4c459c54bd02a015118",
     "paths_to_import": [
         "common",
         "py/conftest.py",
index 1a06d71..df61eca 100644 (file)
@@ -124,6 +124,9 @@ class StaleElementReferenceException(WebDriverException):
 
 class InvalidElementStateException(WebDriverException):
     """
+    Thrown when a command could not be completed because the element is in an invalid state.
+
+    This can be caused by attempting to clear an element that isn't both editable and resettable.
     """
     pass
 
index 6146680..06fde31 100644 (file)
@@ -24,4 +24,4 @@ from .common.action_chains import ActionChains  # noqa
 from .common.touch_actions import TouchActions  # noqa
 from .common.proxy import Proxy  # noqa
 
-__version__ = '3.8.1'
+__version__ = '3.9.0'
index 03dacfb..730dcf4 100644 (file)
@@ -628,6 +628,14 @@ class WebElement(object):
         return self._parent.execute(command, params)
 
     def find_element(self, by=By.ID, value=None):
+        """
+        'Private' method used by the find_element_by_* methods.
+
+        :Usage:
+            Use the corresponding find_element_by_* instead of this.
+
+        :rtype: WebElement
+        """
         if self._w3c:
             if by == By.ID:
                 by = By.CSS_SELECTOR
@@ -645,6 +653,14 @@ class WebElement(object):
                              {"using": by, "value": value})['value']
 
     def find_elements(self, by=By.ID, value=None):
+        """
+        'Private' method used by the find_elements_by_* methods.
+
+        :Usage:
+            Use the corresponding find_elements_by_* instead of this.
+
+        :rtype: list of WebElement
+        """
         if self._w3c:
             if by == By.ID:
                 by = By.CSS_SELECTOR
index 6c559e6..0a8bfa6 100644 (file)
@@ -22,7 +22,6 @@ except ImportError:
 
 from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
 from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
-from .service import Service
 
 
 class WebDriver(RemoteWebDriver):
@@ -31,20 +30,23 @@ class WebDriver(RemoteWebDriver):
 
     """
 
-    def __init__(self, port=0, executable_path="/usr/bin/safaridriver",
+    def __init__(self, port=0, executable_path="/usr/bin/safaridriver", reuse_service=False,
                  desired_capabilities=DesiredCapabilities.SAFARI, quiet=False):
         """
-        Creates a new instance of the Safari driver.
 
-        Starts the service and then creates new instance of Safari Driver.
+        Creates a new Safari driver instance and launches or finds a running safaridriver service.
 
         :Args:
-         - port - port you would like the service to run, if left as 0, a free port will be found.
+         - port - The port on which the safaridriver service should listen for new connections. If zero, a free port will be found.
+         - quiet - If True, the driver's stdout and stderr is suppressed.
+         - executable_path - Path to a custom safaridriver executable to be used. If absent, /usr/bin/safaridriver is used.
          - desired_capabilities: Dictionary object with desired capabilities (Can be used to provide various Safari switches).
-         - quiet - set to True to suppress stdout and stderr of the driver
+         - reuse_service - If True, do not spawn a safaridriver instance; instead, connect to an already-running service that was launched externally.
         """
-        self.service = Service(executable_path, port=port, quiet=quiet)
-        self.service.start()
+
+        self._reuse_service = reuse_service
+        if not reuse_service:
+            self.service.start()
 
         RemoteWebDriver.__init__(
             self,
@@ -62,4 +64,5 @@ class WebDriver(RemoteWebDriver):
         except http_client.BadStatusLine:
             pass
         finally:
-            self.service.stop()
+            if not self._reuse_service:
+                self.service.stop()
index 4c287b4..99fbca3 100644 (file)
@@ -45,13 +45,17 @@ def testSelectByIndexSingle(driver, pages):
 @pytest.mark.xfail_chrome
 @pytest.mark.xfail_firefox
 @pytest.mark.xfail_remote
-@pytest.mark.xfail_marionette
-@pytest.mark.xfail_safari
-def testSelectDisabledByIndexShouldThrowException(driver, pages):
+@pytest.mark.xfail_marionette(reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1429403')
+def testSelectDisabledByIndex(driver, pages):
     pages.load("formPage.html")
     sel = Select(driver.find_element(By.NAME, disabledSelect['name']))
-    with pytest.raises(ElementNotSelectableException):
+    if driver.w3c:
+        selected = sel.first_selected_option
         sel.select_by_index(1)
+        assert selected == sel.first_selected_option
+    else:
+        with pytest.raises(ElementNotSelectableException):
+            sel.select_by_index(1)
 
 
 def testSelectByValueSingle(driver, pages):
@@ -67,13 +71,17 @@ def testSelectByValueSingle(driver, pages):
 @pytest.mark.xfail_chrome
 @pytest.mark.xfail_firefox
 @pytest.mark.xfail_remote
-@pytest.mark.xfail_marionette
-@pytest.mark.xfail_safari
-def testSelectDisabledByValueShouldThrowException(driver, pages):
+@pytest.mark.xfail_marionette(reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1429403')
+def testSelectDisabledByValue(driver, pages):
     pages.load("formPage.html")
     sel = Select(driver.find_element(By.NAME, disabledSelect['name']))
-    with pytest.raises(ElementNotSelectableException):
+    if driver.w3c:
+        selected = sel.first_selected_option
         sel.select_by_value('bar')
+        assert selected == sel.first_selected_option
+    else:
+        with pytest.raises(ElementNotSelectableException):
+            sel.select_by_value('bar')
 
 
 def testSelectByVisibleTextSingle(driver, pages):
@@ -103,13 +111,17 @@ def testSelectByVisibleTextShouldNormalizeSpaces(driver, pages):
 @pytest.mark.xfail_chrome
 @pytest.mark.xfail_firefox
 @pytest.mark.xfail_remote
-@pytest.mark.xfail_marionette
-@pytest.mark.xfail_safari
-def testSelectDisabledByVisibleTextShouldThrowException(driver, pages):
+@pytest.mark.xfail_marionette(reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1429403')
+def testSelectDisabledByVisibleText(driver, pages):
     pages.load("formPage.html")
     sel = Select(driver.find_element(By.NAME, disabledSelect['name']))
-    with pytest.raises(ElementNotSelectableException):
+    if driver.w3c:
+        selected = sel.first_selected_option
         sel.select_by_visible_text('Bar')
+        assert selected == sel.first_selected_option
+    else:
+        with pytest.raises(ElementNotSelectableException):
+            sel.select_by_visible_text('Bar')
 
 
 def testSelectByIndexMultiple(driver, pages):