在使用Appium进行移动应用自动化测试时,我们可能会遇到各种各样的错误。其中一个常见的错误就是'WebDriver' object has no attribute 'find_element_by_id'。这个错误通常表示你尝试使用了一个不存在的方法或属性。下面,我们将分析这个错误的原因,并提供解决方案。 错误原因 方法使用错误:在较新版本的Appium和Selenium...
问题:Appium自动化测试报错'WebDriver' object has no attribute 'find_element_by_id' 原因:在新版本的Selenium Webdriver中,find_element_by_*系列的方法已经被废弃 解决:使用新的方法find_element()结合By类进行元素定位。 需要从selenium.webdriver.common.by导入By类,然后使用find.element()方法,并传递By.ID作为...
searchTag = driver.find_element_by_id("su") 在版本没有更新之前,通常情况下运行都是能够正确定位到对应的元素,但是Selenium经过版本升级之后,运行后会报错,以driver.find_element_by_id(“value”)为例(其他报错也是类似下面的报错信息),运行后会出现上面的错误。 4版本的Selenium已经不再支持上面的写法,我们需...
2.查看网上解决方案,有人提到现在的版本不支持find_element_by_id,目前写法为driver.find_element(By.ID,"com.android.settings:id/search"),修改后运行,仍然报错 3.ctrl+查看find_element方法,直接复制注释中的driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='accessibility_id'),AppiumBy报错 4.找到h...
完美解决:python selenium 报错 AttributeError: ‘WebDriver’ object has no attribute ‘find_element_by_id’ 代码如下 报错如下: 解决方式 selenium版本更新:find_element() 版本更新了,现在的写法为: ByID,'kw').sendkeys('搜索')//关注公众号:小千哥...
解析:如上代码在脚本通过“find_element_by_id”获取元素对象的时候就一直报错,断点查看“driver”对象是存在的,但是“find_element_by_id”不存在,是因为版本问题吗? 有没有大佬帮忙看一下,刚刚学,不是很懂,谢谢。 pythonselenium 有用关注2收藏 回复 阅读776 1...
driver.find_element_by_id 找不到的时候是抛异常,不是返回False.所以你需要使用try-catch,或者是改用带s的版本:driver.find_elements_by_id 如果使用带s的版本,找不到时是返回[],不会抛异常。
el = driver.find_element_by_id("editText") 使用find_element_by_id() 函数报错,程序中确实有此 id 控件,求大神指导 appium 报错: info: [BOOTSTRAP] [debug] Finding container using ID with the contextId: info: [BOOTSTRAP] [info] Returning result: {"value":"Could not find an element using...
报错:NoSuchElementException find_elements_by_id : 1).查找多个,得到一个列表 2.查找不到元素的话,得到的是一个空列表 在实际定位的时候,不知道该元素存不存在,可以用下面的判断方法: if not driver.find_elements_by_id("kk") print("该元素不存在") ...
是不是因为登录百度时候优先出现二维码,所以报错了。 selenium.common.exceptions.InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated (Session info: chrome=63.0.3239.108) (Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8...