Webdriver Element is not currently visible 解决方法
2015-11-27 18:11
706 查看
转载地址:http://blog.sina.com.cn/s/blog_505bf9af0101bdtq.html
Element is not currently visible and so may not be interacted with 解决方法
先看截图:
Webdriver Element is not currently visible 解决方法
在Firebug中对应的html源码,见高亮显示。
Webdriver Element is not currently visible 解决方法
如果用:
driver.findElement(By.className(“cancelBtn”)).click();
或 driver.findElement(By.id(“save_btn”)).click();
就会报“Element is not currently visible and so may not be interacted with”错误
解决方法:
思路: 使用 findElements遍历,input标签,然后找到share按钮对应的 索引值,然后再操作。
List element=driver.findElements(By.tagName(“input”));
for(WebElement e:element)
{
System.out.println(e.getAttribute(“id”));
}
element.get(78).click();
至此 问题解决。
问题更正: 此种问题的关键是在于用className和id都不唯一所以找不到对象,改为:
driver.findElement(By.xpath(“//input[@value=’Share’]”)).click();同样可以解决问题。
Element is not currently visible and so may not be interacted with 解决方法
先看截图:
Webdriver Element is not currently visible 解决方法
在Firebug中对应的html源码,见高亮显示。
Webdriver Element is not currently visible 解决方法
如果用:
driver.findElement(By.className(“cancelBtn”)).click();
或 driver.findElement(By.id(“save_btn”)).click();
就会报“Element is not currently visible and so may not be interacted with”错误
解决方法:
思路: 使用 findElements遍历,input标签,然后找到share按钮对应的 索引值,然后再操作。
List element=driver.findElements(By.tagName(“input”));
for(WebElement e:element)
{
System.out.println(e.getAttribute(“id”));
}
element.get(78).click();
至此 问题解决。
问题更正: 此种问题的关键是在于用className和id都不唯一所以找不到对象,改为:
driver.findElement(By.xpath(“//input[@value=’Share’]”)).click();同样可以解决问题。
相关文章推荐
- 简单视差特效的实现
- lua 小技巧
- eclipse 修改中英文显示
- AndroidStudio中project的model在Android目录中显示
- tomcat使用memcached完成集群
- Android NDK学习之三、 Android.mk的制作
- [python]打开文件操作open用法
- BZOJ 2823: [AHOI2012]信号塔
- 【Project Euler 1】Multiples of 3 and 5
- iOS学习之TableView03自定义UITableViewCell
- 黑马程序员—Java基础—网络编程
- 将tomcat映射到不同的域名
- javascript 小练习:隔行变色、错误处理
- 基于dubbo框架下的RPC通讯协议性能测试 (顶)
- java hdu2087
- word-wrap、white-space和word break的区别
- QT子窗口及停靠实现
- Check if KeyValuePair exists with LINQ's FirstOrDefault
- 初识windows程序需要了解的知识点
- 用AsyncHttpClient访问xml页面