Keys.ESCAPE in selenium webdriver (python)

I use selenium webdriver(s python). I have a use case where I want to check that the submit button is disabled after the form is submitted. To test it, I send a key ESCAPEto stop the page from loading on the next page so that I can access elements of the same page.

password.send_keys("abcdef", Keys.ENTER, Keys.ESCAPE)

The problem is that it works fine in Firefox, but it doesn't work in Chrome. In submitting Chrome, ESCAPEit seems like it is not working, and it submits a form and loads the next page.

Is there any other solution or workaround to overcome this?

+1
source share
2 answers

After you try many options, finally, the following parameter works -

password.send_keys("abcdef", Keys.ENTER, Keys.ESCAPE)  # this works for Firefox driver
drive.execute_script("window.stop();")                 # this works for Chrome driver
+1
source

All Articles