id定位是在所有定位方式中最简单、最准确的一种定位方式,id定位的常用方法有两个:find_element_by_id()和find_elements_by_id()
区别:
后一个是一个复数形式,如果页面中元素id是不重复的,就使用第一种方法;如果该页面中存在多个元素id相同的元素就要使用第二个方法,该方法返回的是一个元素列表,列表中列出了所有id为该值的所有元素
使用方法
element = driver.find_element_by_id('foo')
element.click()
elements = driver.find_elements_by_id('foo')
elements[1].click()
from appium import webdriver
import time
from selenium.common.exceptions import NoSuchElementException
def android_driver():
desired_cap={}
desired_cap['platfor