简体   繁体   English

Appium driver.find_element() 返回字典 [错误]

[英]Appium driver.find_element() returns Dictionary [Error]

Appium verison: 2.1.4 Appium 版本:2.1.4
Selenium version: 4.0.0 Selenium 版本:4.0.0

driver.find_element() returns a dictionary instead of an element object, so while doing driver.find_element().click() the following error is thrown. driver.find_element()返回字典而不是元素 object,因此在执行driver.find_element().click()时会抛出以下错误。

'dict' object has no attribute 'click' 'dict' object 没有属性 'click'

Similar question can be found here and here可以在这里这里找到类似的问题

But the fix didnt work.但修复没有奏效。 Any help would be appreciated任何帮助,将不胜感激

A workaround to solve this without updating Appium:在不更新 Appium 的情况下解决此问题的解决方法:

if type(element) is dict:
    first_element = list(element.values())[0]
    element = driver.create_web_element(element_id=first_element)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Appium driver.find_element() reutrn dict 而不是 webelement - Appium driver.find_element() reutrn dict instead of webelement 错误 driver.find_element 或 find_elements - error driver.find_element or find_elements 与 selenium driver.find_element 不一致 - Inconsistency with selenium driver.find_element Python Selenium driver.find_element().text 返回空字符串,但文本在 driver.page_source 中可见 - Python Selenium driver.find_element().text returns empty string, but text is visible in the driver.page_source 在细分的网页上使用 selenium driver.find_element().click() - Using selenium driver.find_element().click() on a subdivided webpage 我不知道如何使用语句driver.find_element(通过LINK_TEXT, - I don't know how to use statement driver.find_element(By.LINK_TEXT, CV = driver.find_element(By.XPATH('//*[@id="movie_player"]/div[5]/button')) TypeError: 'str' object is not callable - CV = driver.find_element(By.XPATH('//*[@id="movie_player"]/div[5]/button')) TypeError: 'str' object is not callable Appium和python:找到元素子 - Appium and python: find element child 使用 Python 查找驱动程序元素 - Find driver element with Python 如何在 appium python web 驱动程序中将元素定位到屏幕/视图的顶部 - How to posiiton an element to the top of a screen/view in appium python web driver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM