Safari Browser immediately closes after it has been launched

已查看 63 次
跳至第一个未读帖子

Patrick Delaney

未读,
2016年6月27日 01:23:412016/6/27
收件人 Selenium Users
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 a demo of the issue: https://youtu.be/Af2Dr0oWOtE



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.get("http://www.google.com");
    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






Patrick Delaney

未读,
2016年6月27日 12:36:152016/6/27
收件人 Selenium Users
I found the issue, it was human error....

I was cutting ans pasting and put the @After Section before the @Test  so I was closing the program too soon.

Pat
回复全部
回复作者
转发
0 个新帖子