前段时间用webdriver写自动化测试的脚本的时候,遇到了如下问题:页面上的元素可见,而且用exists?判断返回结果为:ture。
但是在对页面元素操作的时候,却报错了:Element is not currently visible and so may not be interacted withat。
后来发现了问题所在,以为弹出窗口等原因,页面上肯定不只一个当前要定位的元素。多见于:确认,取消等按钮。你判断返回存在的可能并不是你需要的那个元素。
这个时候最好的办法就是使用xpath去定位。
后来终于用xpath操作成功!
分享到:
相关推荐
使用webdriver实现主页面跳转到子页面后又回到主页面的操作
selenium xpath webdriver_element locator webdriver_element_locator-1.rev312-fx.xpi work with firefox version 19-37
很好的WebDriver Xpath Css 元素识别参考 http://www.techques.com/question/1-8076659/Selenium-WebDriver-Issue-with-By.CSSSelector http://blog.csdn.net/expect88/article/details/8279435
Firefox浏览器xpath插件webdriver_element_locator-1.rev312-fx.xpi
在Selenium WebDriver中使用By.Xpath快速定位页面元素,实现多属性定位一个元素。
webtable类-对于页面中列表含有table的,获取元素对象的方法类
为了更好地学习WebDriver的八种定位元素的方式,我们使用附件中的注册页面来练习自动化脚本的设计。 博文链接:https://blog.csdn.net/weixin_44679832/article/details/103807698
Selenium WebDriver 学习笔记 API大全 中文API 元素 操作大全
3.2 如何对页面元素进行操作 8 3.2.1 输入框(text field or textarea) 8 3.2.2 下拉选择框(Select) 9 3.2.3 单选项(Radio Button) 9 3.2.4 多选项(checkbox) 10 3.2.5 按钮(button) 10 3.2.6 左右选择框 11 3.2.7...
使用Selenium自带的API操作Select元素时页面可能出现上移或遮挡,导致元素操作失败; 介于此问题,可以使用JQuery来操作Select元素,具体实现见附件。
为了更好地学习WebDriver的八种定位元素的方式,我们使用附件中的注册页面来练习自动化脚本的设计。 博文链接:https://blog.csdn.net/weixin_44679832/article/details/103807698
Selenium WebDriver Practical Guide will guide you through the various APIs of WebDriver which should be used in automation tests, followed by a discussion of the various WebDriver implementations ...
Selenium WebDriver is an open source automation tool implemented through a browser-specific driver, which sends commands to a browser and retrieves results. The latest version of Selenium 3 brings ...
WebDriver目前不支持H5页面上的元素拖动,该JS是对H5页面注入JS后以支持该功能
主要介绍了解决webdriver.Chrome()报错:Message:'chromedriver' executable needs to be in Path ,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
全书共分为四个部分:第1部分基础篇主要讲解自动化测试相关的基础理论、WebDriver 环境安装、单元测试工具的使用方法以及 WebDrvier的入门使用实例,第2部分实战应用篇基于丰富的实战案例讲解页面元素的定位方法以及...
元素不存在,操作元素也会报错 第一种:捕获异常 弊端:只要页面上有元素,不几个,都返回True from selenium import webdriver import unittest class Test1(unittest.TestCase): # 一、准备浏览器驱动、网站...
requests is temporary and that this will be removed sometime before the 1.0 release. duration field made optional on pause actions A regression in 0.22.0 caused the pause action primitive to require...
webdriver安装包