Failed to click a button in Safari using Selenium WebDriver

I want to click the next button, but when I run the script, the button will not be pressed until the script passes.

Below is an HTML snippet

<input type="button" value="Authorize" class="standard" id="oauth2button" style="margin-left: 60px;">

Here is the ruby ​​code I used to perform the click operation

authorize_button = $driver.find_element(:id, 'oauth2button')
authorize_button.click

If I use authorize_button.displayed?, it returns true. I am using Selenium WebDriver and the version of Safari is 6.1.1.

+4
source share
1 answer

, , , , , - JavaScript Selenium, . - :

$driver.execute_script("document.getElementById('oauth2button').click();")
+1

Source: https://habr.com/ru/post/1535529/


All Articles