gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 11:39:40 24 4
gpt4 key购买 nike

我正在做一个简单的基本程序,但是当我两天前做同样的事情时,一切都工作正常,但现在点击链接不起作用..我正在使用 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/

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