Hi I am using Selenium Standalone Server along with Selenese command executor for testing on Safari on Mac OS X. Im facing issues in clicking some buttons on specific pages. The same clicks work perfectly in other browsers like firefox(Windows),chrome(Windows+Mac),IOS simulators,IE. Also im able to get the button through id.Confirmed by getting the buttons text using : getText(). Only thing is nothing happens after the click command. I have tried using button.click() , button.submit(). also used id, xpath , class to find the button. As i mentioned : Im able to get the id, just that the click is not working. any suggestions? some of the code is:
public static WebDriver getSafariDriver()
{
try
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("safari");
capabilities.setJavascriptEnabled(true);
CommandExecutor executor = new SeleneseCommandExecutor(new URL("http://localhost:4444/"), new URL("http://www.google.com/"), capabilities);
WebDriver driver = new RemoteWebDriver(executor, capabilities);
return driver;
} catch (MalformedURLException e)
{
e.printStackTrace();
}
return null;
}
Is there any workaround through command prompt ? Or anything else that i can try or am missing out? Please help.
I had the same issue with Safari 10+, OSX El Capitan and Selenium 3.0.1
Another alternative may be to send a RETURN key implemented in Python:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Safari()
driver.get('http://localhost:8000')
element = driver.find_element_by_id("submit")
element.send_keys(Keys.RETURN)
Try using javascript executor
WebElement yourelement= driver.findElement(By.id("btn"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", yourelement);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With