gpt4 book ai didi

java - Selenium : Expected [object Undefined] 的 Java 错误

转载 作者:搜寻专家 更新时间:2023-10-31 08:31:46 31 4
gpt4 key购买 nike

I don't understand why I get the error 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}]

最佳答案

要使用 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");

关于java - Selenium : Expected [object Undefined] 的 Java 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43472172/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com