我在Selenium中有以下代码:
package automationFramework;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class FirstTestCase {
private static RemoteWebDriver jse;
public static void main(String[] args) { // TODO Auto-generated method stub //Create a new instance of firefox driver
System.setProperty("webdriver.gecko.driver","C:\\Users\\Javier\\Desktop\\selenium webdriver\\Gecko\\geckodriver.exe");
WebDriver driver = new FirefoxDriver(); //Launch one web
driver.get("xxxx");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.className("mymwc-trigger")).click();
driver.findElement(By.className("mymwc-user")).sendKeys("x");
driver.findElement(By.className("mymwc-pass")).sendKeys("xx");
driver.findElement(By.className("login-submit")).click();
driver.findElement(By.className("continuebutton")).click();
WebDriverWait wait = new WebDriverWait(driver, 3);
driver.findElement(By.partialLinkText("working")).click();
}
private static void sleep(int i) {
// TODO Auto-generated method stub
}
}
当我把最后一行driver.finElement...
放入时,我遇到以下错误:
错误:
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 57.0.4, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 74088, moz:profile: C:\Users\Javier\AppData\Loc..., moz:webdriverClick: false, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 6.1, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: b971b950-623d-47a8-8dc2-dba68146b9cc
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
at automationFramework.FirstTestCase.main(FirstTestCase.java:39)
你可以帮帮我吗? geckodriver
是否有任何限制?