0

我是使用 Selenium 和 Appium 进行移动测试的新手。我们已经使用 selenium 网络驱动程序来自动化我们的网站,并希望朝着移动应用程序的自动化迈进。

我希望我能得到一些快速的指示。我无法选择此元素然后发送文本以开始登录过程,我已经研究了几个小时以找到可能的视频帮助等。

下面是 Appium 的屏幕截图,我正在尝试选择电子邮件字段,但看不到使用 ID 或 xpath:https ://screencast.com/t/KokZ2tCgjLG4

我正在寻找元素,然后将密钥发送到该字段,以便我可以登录应用程序。

这是我的代码:

def setUp(self):
desired_caps = {}
desired_caps[‘platformName’] = 'Android’
desired_caps[‘platformVersion’] = ‘8.0’
desired_caps[‘deviceName’] = ‘Pixel’
desired_caps[‘app’] = PATH(
’/Users/stevenrutherford/desktop/Android/foodlogiq-x86.apk’
)
desired_caps[‘appPackage’] = 'com.foodlogiq.connect’
desired_caps[‘appActivity’] = ‘.MainActivity’

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


def test_login(self):
    time.sleep(15)

    email = self.driver.find_element_by_xpath("//*[@contentDescription='EMAIL ']") #I have try multiple options here
    email.click()

而且我似乎无法让 Appium 找到元素:

[HTTP] --> POST /wd/hub/session/a56058ad-94e9-4a69-a554-ad7bc3d2b6b7/element {“using”:“xpath”,“sessionId”:“a56058ad-94e9-4a69-a554-ad7bc3d2b6b7”,“value”:"//[@contentDescription='EMAIL ']"}
[MJSONWP] Calling AppiumDriver.findElement() with args: [“xpath”,"//[@contentDescription='EMAIL ']",“a56058ad-94e9-4a69-a554-ad7bc3d2b6b7”]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 0 ms for condition
[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//[@contentDescription='EMAIL ']",“context”:"",“multiple”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//[@contentDescription='EMAIL ']",“context”:"",“multiple”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[@contentDescription='EMAIL ‘]’ using ‘XPATH’ with the contextId: ‘’ multiple: false

它在这一点上没有单击元素或向前移动甚至尝试输入电子邮件地址。

4

0 回答 0