Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10203)

Unified Diff: chrome/test/chromedriver/test/run_py_tests.py

Issue 2125123002: [chromedriver] Add page loading strategy to capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge conflicts Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/test/run_py_tests.py
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py
index 34e5c03274ef1675bd4f7c2bc4b9c5610a9be467..92befde26e00b4b27af1ed986efc7bf0f4b25522 100755
--- a/chrome/test/chromedriver/test/run_py_tests.py
+++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -551,6 +551,11 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
alert_button.Click()
self.assertTrue(self._driver.IsAlertOpen())
+ def testPageLoadingCapabilityDefault(self):
+ # normal by default
+ self.assertEquals('normal',
+ self._driver.capabilities['pageLoadingStrategy'])
+
def testClearElement(self):
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html'))
text = self._driver.ExecuteScript(
@@ -1710,6 +1715,31 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest):
self.assertIn('hasTouchScreen', driver.capabilities)
self.assertTrue(driver.capabilities['hasTouchScreen'])
+ def testPageLoadingCapabilityNone(self):
+ class HandleRequest(object):
+ def __init__(self):
+ self.sent_hello = threading.Event()
+
+ def slowPage(self, request):
+ self.sent_hello.wait(2)
+ return {}, """
+ <html>
+ <body>hello</body>
+ </html>"""
+
+ handler = HandleRequest()
+ self._http_server.SetCallbackForPath('/slow', handler.slowPage)
+
+ driver = self.CreateDriver(page_load_strategy='none')
+ self.assertEquals('none', driver.capabilities['pageLoadingStrategy'])
+
+ driver.Load(self._http_server.GetUrl() + '/chromedriver/empty.html')
+ driver.Load(self._http_server.GetUrl() + '/slow')
+ self.assertFalse('hello' in driver.GetPageSource())
+ handler.sent_hello.set()
+ self.WaitForCondition(lambda: 'hello' in driver.GetPageSource())
+ self.assertTrue('hello' in driver.GetPageSource())
+
def testNetworkConnectionDisabledByDefault(self):
driver = self.CreateDriver()
self.assertFalse(driver.capabilities['networkConnectionEnabled'])
@@ -1838,7 +1868,6 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest):
network = driver.GetNetworkConnection()
self.assertEquals(network['connection_type'], connection_type)
-
class ChromeDriverLogTest(ChromeDriverBaseTest):
"""Tests that chromedriver produces the expected log file."""

Powered by Google App Engine
This is Rietveld 408576698