java - 单击链接在 selenium webdriver 2.45.0 中不起作用

标签 java selenium eclipse-luna

我正在做一个简单的基本程序,但是当我两天前做同样的事情时,一切都工作正常,但现在点击链接不起作用..我正在使用 mozilla 23 和 selenium 2.45 。这是我的程序

package basics;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
public class first {
public static void main(String[] args) {
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://www.gmail.com");
driver.findElement(By.id("Email")).sendKeys("abcd");
driver.findElement(By.id("Passwd")).sendKeys("xxxx");
driver.findElement(By.id("SignIn")).click();
}
}

这是我收到的错误:

Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"SignIn"}
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'Arpita', ip: '100.98.209.144', os.name: 'Windows NT (unknown)', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_02'
Driver info: driver.version: unknown
at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/Arpitaa/AppData/Local/Temp/anonymous8522624877654328923webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10271)
at <anonymous class>.FirefoxDriver.prototype.findElement(file:///C:/Users/Arpitaa/AppData/Local/Temp/anonymous8522624877654328923webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10280)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/Arpitaa/AppData/Local/Temp/anonymous8522624877654328923webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12274)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/Arpitaa/AppData/Local/Temp/anonymous8522624877654328923webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12279)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/Arpitaa/AppData/Local/Temp/anonymous8522624877654328923webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12221)

最佳答案

它是登录,而不是登录。尝试使用小写的 's'。区分大小写对于在 DOM 中定位 Web 元素很重要。

关于java - 单击链接在 selenium webdriver 2.45.0 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29642747/

相关文章:

java - Eclipse 和 Tomcat - 类加载

python - 类型错误 : 'str' object is not callable using Selenium through Python

android - 在 google play services rev 22 上找不到 LocationClient 类

Eclipse/PyDev - 打开两个同名文件时从编辑器选项卡中删除路径

java - Angular 2 : Using a . jsp 文件作为组件的模板

python - 如何在selenium firefox窗口中使用python更改innerHTML?

python - 遍历 Selenium 2 WebDriver 中的表(python)

java - 多个入口点

java - JDBC 中的表列标题不正确

java - 列表<列表<字符串>>到字符串[][]