使用selenium的java出错:预期
我不明白为什么我得到错误Expected [object Undefined] undefined为一个字符串
这是脚本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_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}]
要使用Selenium 3.x,Mozila Firefox 52.x,您需要从这里下载最新的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");
- 无法使用IEDriver单击IE上的链接
- 像Firefox一样使用标题制作JPanel边框
- 使用Selenium WebDriver和Tor
- java运行时6与socks v5代理 – 可能吗?
- 使用Selenium WebDriver未检测到Firefox警报框
- Selenium WebDriver鼠标操作moveToElement不会在Firefox Linux上引发mouseout事件
- 编写一个firefox插件并从java应用程序访问它
- Selenium 3.0 Firefx驱动程序因org.openqa.selenium.SessionNotCreatedException而失败:无法创建新的远程会话
- “安全设置阻止的应用程序”阻止在Linux上使用oracle SE 7更新51运行的applet