Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么我不能从APK中选择元素?_Python_Testcase_Appium - Fatal编程技术网

Python 为什么我不能从APK中选择元素?

Python 为什么我不能从APK中选择元素?,python,testcase,appium,Python,Testcase,Appium,我想使用python从apk中选择一个元素。它总是返回null返回。这是我的密码 import os from selenium import webdriver # Returns abs path relative to this file and not cwd PATH = lambda p: os.path.abspath( os.path.join(os.path.dirname(__file__), p) ) desired_caps = {} desired_caps

我想使用python从apk中选择一个元素。它总是返回null返回。这是我的密码

import os
from selenium import webdriver

# Returns abs path relative to this file and not cwd
PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)
)

desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
desired_caps['app'] = PATH('/home/user/Desktop/abs.apk')
desired_caps['app-package'] = 'lk.xyz.abs'
desired_caps['app-activity'] = '.abs'

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

textfields = driver.find_elements_by_tag_name("input")
textfields[1].send_keys("observer")
textfields[2].send_keys("test")
abspath(os.path.dirname(os.path.realpath(文件)))
os.path.abspath(os.path.dirname(os.path.realpath(__file__)))