【发布时间】:2021-03-08 14:27:03
【问题描述】:
我是 web 自动化和 python 的新手,所以请理解我的问题对你们来说可能是微不足道的。我正在尝试使用 Appium 来测试应用程序并按下屏幕上的按钮。使用我的最低知识,我在下面创建了一个测试用例,目的是为了做到这一点,但我得到一个错误 'dict' object has no attribute 'driver'
from appium import webdriver
import time
def setUp():
self = dict(
platformName = "Android",
platformVersion = "10",
deviceName= "name",
app= "C:\\AppiumProjects\\app-debug.apk",
automationName= "UiAutomator2",
appActivity = ".activities.SplashScreenActivity",
appPackage = 'genericsurveyapp2',
noReset = True,
)
self.driver = webdriver.Remote('http://localhost:4723/wd/hub',self)
time.sleep(2)
time.sleep(2)
self.el = self.driver.find_element_by_id("idacceptButton")
time.sleep(2)
self.el.click
setUp()
【问题讨论】:
-
不要在变量声明中使用点 (.)。试试这个:
self_driver = .........
标签: python mobile automation appium