def findElement(driver,id):

    if (driver.find_elements_by_id(id).is_displayed()):

        driver.find_elements_by_id(id).click
    else:
        driver.find_element_by_id('com.tuniu.app.ui:id/iv_style3_card_1').click


findElement(driver, 'android:id/button1')

报错信息:

Traceback (most recent call last):

findElement(driver, 'android:id/button1')

if (driver.find_elements_by_id(id).is_displayed()):
AttributeError: 'list' object has no attribute 'is_displayed'

我的疑问是,判断机制貌似没有生效,找了那个不存在的 id 后抛了异常,
对于 python,我知之不多,希望懂的朋友帮我看看如何修改。


↙↙↙阅读原文可查看相关链接,并与作者交流