I am using Safari 5.1.7 with Webdriver extension 2.48. When I run just a simple script the Safari browser open, starts to do something and then immediately closes Safari.
Here is the sample java code:
//import static org.junit.Assume.assumeTrue;
//import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.junit.runners.JUnit4;
public class SafariDriverTests {
private WebDriver driver = null;
@Before
public void createDriver() {
driver = new SafariDriver();
}
@After
public void quitDriver() {
driver.quit();
}
@Test
public void shouldBeAbleToPerformAGoogleSearch() {
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("btnG")).click();
new WebDriverWait(driver, 30).until(ExpectedConditions.titleIs("webdriver - Google Search"));
}
}
Any Ideas why it's closing?
Jun 24, 2016 8:05:07 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 36997
Jun 24, 2016 8:05:07 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Launching Safari
Jun 24, 2016 8:05:07 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Waiting for SafariDriver to connect
Jun 24, 2016 8:05:08 PM org.openqa.selenium.safari.SafariDriverChannelHandler$1 operationComplete
INFO: Connection opened
Jun 24, 2016 8:05:08 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Driver connected in 839 ms
Jun 24, 2016 8:05:10 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutting down
Jun 24, 2016 8:05:10 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Closing connection
Jun 24, 2016 8:05:10 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping Safari
Jun 24, 2016 8:05:10 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping server
Jun 24, 2016 8:05:10 PM org.openqa.selenium.safari.SafariDriverServer stop
INFO: Stopping server
Jun 24, 2016 8:05:10 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutdown complete