webdriver
webdriver copied to clipboard
Navigation in `execute a function body` should abort script execution
If a navigation happens while a script is getting executed the script would always timeout if there isn't an early break out. As of now there is nothing listed in the Webdriver spec:
https://w3c.github.io/webdriver/#execute-script#x13-2-executing-script
With Marionette/geckodriver we currently return a JavascriptError.
CC'ing @jgraham, @andreastt, @AutomatedTester, @shs96c.
If the proposed solution from @whimboo is ok, I would love to take a stab at this to bring this into the protocol. I created a wpt test for it at https://github.com/web-platform-tests/wpt/pull/15517
test_script_abortion_due_navigation_change_via_location
passes in Firefox, fails in Chrome because status code is 500, expected 400esponse = execute_async_script(session, """ const url = arguments[0]; const resolve = arguments[1]; setTimeout(() => resolve('navigation change'), 1000); window.location = url; """, [url])- I also added a test to check what happens if the context is being changed
passes both in Chrome and Firefox, is that expected?esponse = execute_async_script(session, """ const url = arguments[0]; const resolve = arguments[1]; setTimeout(() => resolve('context change'), 1000); window.open(url); """, [url])
What do you all think?
At least in Firefox we already have that feature in place, so it should pass yes.