org.openqa.selenium.NoSuchElementException: Unable to locate element: 异常解决方法
来源:互联网 发布:外国在线视频下载软件 编辑:程序博客网 时间:2024/06/04 18:10
现象:出现报错org.openqa.selenium.NoSuchElementException: Unable to locate element
原因:进入网页时,网页可能在loading中,因此找不到元素。
解决方法:你可以让他休眠Thread.sleep(2000),即休眠2秒,应该可以找到元素了。
将Thread.sleep(2000)加在
System.setProperty("webdriver.firefox.bin","D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://localhost:9090/jenkins");
Thread.sleep(2000);
driver.findElement(By.id("j_username")).sendKeys("admin");
driver.findElement(By.name("j_password")).sendKeys("b7588402d6ee48f5847ff6f7491c3dd2");
driver.findElement(By.id("yui-gen1-button")).click();
阅读全文
1 0
- org.openqa.selenium.NoSuchElementException: Unable to locate element: 异常解决方法
- NoSuchElementException: Unable to locate element--三种系统等待时间
- xpath定位报错org.openqa.selenium.NoSuchElementException:
- org.openqa.selenium.ElementNotVisibleException: element not visible
- selenium异常:org.openqa.selenium.remote.UnreachableBrowserException
- Selenium firefox不兼容org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.
- selenium firefoxdriver:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host
- 解决网页元素无法定位(NoSuchElementException: Unable to locate element)的几种方法
- org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055
- 解决方案:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port
- unable to locate解决方法
- org.openqa.selenium.StaleElementReferenceException
- org.openqa.selenium.StaleElementReferenceException
- org.openqa.selenium.ElementNotVisibleException
- 解决Selenium弹出新页面无法定位元素问题(Unable to locate element)
- Unable to locate package解决方法
- 【Selenium异常】NoSuchElementException
- no such element: Unable to locate element--窗口切换
- JSOUP实践:解析和遍历HTML文档
- linux安装mariadb
- 使用Docker运行TensorFlow
- 线段树总结
- postgresql数据库使用函数查询所有符合条件的表名,以及删除所有查询到的表的数据
- org.openqa.selenium.NoSuchElementException: Unable to locate element: 异常解决方法
- [.cpp]挑战程序设计问题的利器 freopen()函数
- Airflow 初试
- 详解jdbcTemplate和namedParameterJdbcTemplate
- MyEclipse10和MyEclipse2014项目之间的导入
- FZU-2254 英语考试
- Shape Correspondence and Functional Maps
- C++类与对象——日期类
- Lucene查询索引