我使用webdriver的硒3.0和硒的Javajava.lang.IllegalStateException:眼睛無法打開
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-selenium-java</artifactId>
<version>2.54</version>
</dependency>
對於視覺測試AppliToolsEyes 2.54寫下下面的代碼 -
private WebDriver driver;
private Eyes eyes;
private static final String url = "http://www.google.com";
@BeforeClass
public void setUp(){
eyes = new Eyes();
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "//src//test//resources//geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().window().maximize();
}
@AfterClass
public void tearDown(){
eyes.abortIfNotClosed();
driver.quit();
}
@Test
public void visualTest(){
eyes.checkWindow();
driver.get(url);
eyes.checkWindow();
eyes.close();
}
,但得到以下錯誤時運行的代碼eyes.checkWindow()
java.lang.IllegalStateException: Eyes not open at com.applitools.utils.ArgumentGuard.isValidState(ArgumentGuard.java:117) at com.applitools.eyes.EyesBase.checkWindowBase(EyesBase.java:977) at com.applitools.eyes.Eyes.checkWindow(Eyes.java:359) at com.applitools.eyes.Eyes.checkWindow(Eyes.java:335) at com.applitools.eyes.Eyes.checkWindow(Eyes.java:325)