还未发布过话题
  • 我在 UI Automator Viewer 里面获取了 resource id,但是运行时还是报错找不到该元素,为什么呢?我是真机测试
    #! /usr/bin/env python
    #coding=utf-8
    import os
    import time
    import unittest
    from selenium import webdriver
    from lib2to3.pgen2.driver import Driver
    from lib2to3.tests.support import driver

    PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(file),p))
    global driver

    desired_caps = {}
    desired_caps['platformName'] = 'Android'
    desired_caps['platformVersion'] = '4.2'
    desired_caps['deviceName'] = 'Lenovo P1c72'
    desired_caps['app'] = PATH('C:\Users\LENOVO\Desktop\StarZone_V2.0.0.apk')

    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

    driver.find_element_by_id("com.xiangchao.starspace:id/skip").click()

    报错:
    selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.