【问题标题】:Error in java with selenium : Expected [object Undefined]带有 selenium 的 java 中的错误:预期 [object Undefined]
【发布时间】:2017-09-14 07:01:25
【问题描述】:

我不明白为什么会收到错误 Expected [object Undefined] undefined to be a string

这里是脚本 java LoginToGmail.java

WebDriver driver;
driver =new FirefoxDriver();
driver.manage().window().maximize();
driver.navigate().to("http://www.facebook.com");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
WebElement act= driver.findElement(By.id("email"));
act.sendKeys("rupali9392@gmail.com");

全栈错误是:

org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a
string Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
Capabilities [{moz:profile=C:\Users\SHEKHAR\AppData\Local\Temp\rust_mozpr‌​ofile.mipot0y6Nzs5,
rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, 
pageLoadStrategy=normal ,platform=ANY, specificationLevel=0, moz:accessibilityChecks=false,
acceptInsecureCerts=false, browserVersion=53.0, platformVersion=6.1, moz:processID=5892,
browserName=firefox, platformName=windows_nt}] 

【问题讨论】:

  • org.openqa.selenium.InvalidArgumentException:预期 [object Undefined] 未定义为字符串 构建信息:版本:'unknown',修订:'5234b32',时间:'2017-03-10 09 :00:17 -0800' 能力 [{moz:profile=C:\Users\SHEKHAR\AppData\Local\Temp\rust_mozprofile.mipot0y6Nzs5, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000} , pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0, platformVersion=6.1, moz:processID=5892, browserName=firefox, platformName=windows_nt}]
  • 我的目标只是尝试打开浏览器并导航到 facebook
  • 这是由于 Mozilla 的 geckodriver 中的一个错误。即将修复,但未公布发布日期。
  • 我不能使用 Mozilla 和 Selenium 3.0??请帮帮我

标签: java selenium firefox selenium-webdriver geckodriver


【解决方案1】:

要使用 Selenium 3.x、Mozila Firefox 52.x,您需要从 here 下载最新的 gecko 驱动程序并提供 gecko 驱动程序的绝对路径如下:

//Mozila Firefox
System.setProperty("webdriver.gecko.driver", "C:\\your_directory\\geckodriver.exe");
WebDriver driver =  new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http:\\gmail.com");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.id("Email")).sendKeys("your_id");

【讨论】:

    猜你喜欢
    • 2017-09-25
    • 1970-01-01
    • 2017-09-20
    • 1970-01-01
    • 2018-11-27
    • 2018-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多