我想使用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")
答案 0 :(得分:0)
os.path.abspath(os.path.dirname(os.path.realpath(__file__)))