TA的每日心情 | 奋斗 2017-5-17 20:11 |
---|
签到天数: 2 天 连续签到: 2 天 [LV.1]测试小兵
|
本帖最后由 catherinepanjl 于 2017-5-14 17:08 编辑
我的selenium版本是3.4.0,我的火狐的版本是:53.0.2,运行脚本的时候报错,请问各位大神有什么解决办法吗?
Exception in thread "main" org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a string
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'HP-6450B', ip: '192.168.11.241', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=d:\temp\rust_mozprofile.4EcdlLaDcOiJ, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.2, platformVersion=10.0, moz:processID=1968.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: 2e19fb13-ca1a-4b0b-82a4-0ec9cba27de7
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:272)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:96)
at mypro.IdDemo.main(IdDemo.java:15)
代码如下:
package mypro;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class IdDemo {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.baidu.com");
WebElement searchBox = driver.findElement(By.id("kw"));
searchBox.sendKeys("test baidu by id");
WebElement searchButton = driver.findElement(By.id("su"));
searchButton.submit();
driver.close();
}
}
|
|