元素定位:

WebDriverWait类

需要导入:from selenium.webdriver.support.wait import WebDriverWait

 

WebDriverWait(driver,超时总时间,频率).until(lambda x:x.find_element_by_**(...))

 

lambda x:x.find_element_by_id(...)

相当于:

def 匿名函数名(x):

    return x.find_element_by_id(...)

 

 

元素操作:

  • 点击元素: click()

  • 发送数据:send_keys(“content_value”)

        输入框输入中文时,需加上两行代码:

        # desired_caps["unicodeKeyboard"] = True #解决中文不能 输入

        # desired_caps["resetKeyboard"] = True # 隐藏键盘

  • 清空输入框:edit_text.clear()

  • 获取元素坐标:element.lacation()

获取元素文本内容: .text

获取元素的属性值:

  • get_attribute("name")

  • get_attribute("text")

  • get_attribute("classname")

  • get_attribute("reouseurl")

     classname、resourceId:api>18有效

 

 

坐标:左上角坐标,右下角坐标3.appium 元素定位、元素操作

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-01-16
  • 2021-05-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2021-10-06
  • 2021-09-23
  • 2022-01-01
相关资源
相似解决方案