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

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: clearer naming, checks for valid strategies earlier in parsing 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..a26e3f45824ccba1dc982e81578d7de3162d2df3 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 testPageLoadCapabilityDefault(self):
samuong 2016/07/29 23:33:47 instead of a comment, just name the function so th
evajiang 2016/08/01 16:35:47 Done.
+ # normal by default
+ self.assertEquals('normal',
+ self._driver.capabilities['pageLoadStrategy'])
+
def testClearElement(self):
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html'))
text = self._driver.ExecuteScript(
@@ -1710,6 +1715,35 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest):
self.assertIn('hasTouchScreen', driver.capabilities)
self.assertTrue(driver.capabilities['hasTouchScreen'])
+ def testPageLoadCapabilityNone(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['pageLoadStrategy'])
+
+ 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 testPageLoadStrategyUnsupported(self):
+ self.assertRaises(chromedriver.UnknownError,
+ self.CreateDriver, page_load_strategy="unsupported")
+
def testNetworkConnectionDisabledByDefault(self):
driver = self.CreateDriver()
self.assertFalse(driver.capabilities['networkConnectionEnabled'])

Powered by Google App Engine
This is Rietveld 408576698