APPIUM 问题求助
不用 appium 启动 activity,使用 appium desired_caps['autoLaunch'] = False
,然后用adb shell
命令启动 activity。之后再用使用 appium api 查找元素 就会报错。求助版上的各位大侠。如何解决这个问题呢?
desired_caps['automationName'] = 'Appium'
desired_caps['platformName'] = PLATFROM
desired_caps['platformVersion'] = VERSION
desired_caps['deviceName'] = DEVICE_SN
desired_caps['appPackage'] = PACKAGE
desired_caps['appActivity'] = ACTIVITY
desired_caps['autoLaunch'] = False
desired_caps['newCommandTimeout'] = 900 # unit is seconds
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, keep_alive=True)
adbShell.start_activity("%s/%s"%(PACKAGE,ACTIVITY))
print self.driver.current_activity # 成功,可以返回当前activity
print self.driver.find_element_by_id("home_score")** # 不成功,报错 Cannot call method 'sendAction' of null**
print self.driver.get_window_size() # 不成功,报错 Cannot call method 'sendAction' of null