From 74ddb63b51aadad80a1f00e6fa6746eb31d3cc71 Mon Sep 17 00:00:00 2001 From: "jmikhail@google.com" Date: Thu, 23 Dec 2010 22:24:14 +0000 Subject: Implemnts the commands in webdriver to preform searching of elements on a page. /session/:sessionId/timeouts/implicit_wait /session/:sessionId/element /session/:sessionId/elements /session/:sessionId/element/:id/element /session/:sessionId/element/:id/elements BUG=none TEST=webdriver_remote_tests.py Review URL: http://codereview.chromium.org/3643002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70107 0039d316-1c4b-4281-b951-d872f2087c98 --- .../webdriver/py/selenium/remote/webdriver/WebDriver.py | 11 +++++++++++ third_party/webdriver/py/selenium/remote/webdriver/command.py | 1 + .../py/selenium/remote/webdriver/remote_connection.py | 1 + 3 files changed, 13 insertions(+) (limited to 'third_party') diff --git a/third_party/webdriver/py/selenium/remote/webdriver/WebDriver.py b/third_party/webdriver/py/selenium/remote/webdriver/WebDriver.py index b7246a0..35bff2e 100644 --- a/third_party/webdriver/py/selenium/remote/webdriver/WebDriver.py +++ b/third_party/webdriver/py/selenium/remote/webdriver/WebDriver.py @@ -173,6 +173,17 @@ class WebDriver(object): resp = self._execute(Command.GET_TITLE) return resp['value'] + def set_implicit_wait(self, wait): + """Set the amount of time the driver should wait when searching for + elements. When searching for a single element, the driver should poll + the page until an element is found or the timeout expires, whichever + occurs first. When searching for multiple elements, the driver should + poll the page until at least one element is found or the timeout + expires, at which point it should return an empty list. If this + command is never sent, the driver should default to an implicit wait + of 0ms.""" + self._execute(Command.IMPLICIT_WAIT, {'ms': wait}) + def find_element_by_id(self, id_): """Finds element by id.""" return self._find_element_by("id", id_) diff --git a/third_party/webdriver/py/selenium/remote/webdriver/command.py b/third_party/webdriver/py/selenium/remote/webdriver/command.py index 3eae3b1..b094c5a 100644 --- a/third_party/webdriver/py/selenium/remote/webdriver/command.py +++ b/third_party/webdriver/py/selenium/remote/webdriver/command.py @@ -76,4 +76,5 @@ class Command(object): GET_ELEMENT_ATTRIBUTE = "getElementAttribute" GET_ELEMENT_VALUE_OF_CSS_PROPERTY = "getElementValueOfCssProperty" ELEMENT_EQUALS = "elementEquals" + IMPLICIT_WAIT = "setImplicitWait" SCREENSHOT = "screenshot" diff --git a/third_party/webdriver/py/selenium/remote/webdriver/remote_connection.py b/third_party/webdriver/py/selenium/remote/webdriver/remote_connection.py index 6c23684..5556fc9 100644 --- a/third_party/webdriver/py/selenium/remote/webdriver/remote_connection.py +++ b/third_party/webdriver/py/selenium/remote/webdriver/remote_connection.py @@ -128,6 +128,7 @@ class RemoteConnection(object): Command.GET_CURRENT_URL: ('GET', '/session/$sessionId/url'), Command.GET_TITLE: ('GET', '/session/$sessionId/title'), Command.GET_PAGE_SOURCE: ('GET', '/session/$sessionId/source'), + Command.IMPLICIT_WAIT: ('POST', '/session/$sessionId/timeouts/implicit_wait'), Command.SCREENSHOT: ('GET', '/session/$sessionId/screenshot'), Command.SET_BROWSER_VISIBLE: ('POST', '/session/$sessionId/visible'), -- cgit v1.1