无法在 python 的混合 appium 测试中自动化 webview

Cant automate webview in hybrid appium test in python

我正在尝试对我的应用程序的 WEBVIEW 部分进行自动测试。 我可以切换到 WEBVIEW 上下文,但找不到 UI 元素。

self.driver.find_element_by_accessibility_id('StartTrainingButton').click()
time.sleep(5)

self.driver.switch_to.context('WEBVIEW')
time.sleep(10)

a = self.driver.find_element_by_id('first_name').value_of_css_property(".form-control")
print(a)
time.sleep(5)
self.driver.find_element(id, "wp-submit").click()

这里是文本框的数据first_name:

input class="form-control" type="text" name="first_name" id="first_name" value="" placeholder="Vorname" required=""

对于可能遇到同样问题的人来说,这就是我的混合应用程序的工作原理:

    self.driver.find_element_by_accessibility_id('StartTrainingButton').click()
    time.sleep(5)

    self.driver.switch_to.context('WEBVIEW')
    time.sleep(3)

    self.driver.find_element_by_id('first_name').send_keys('Test_first')
    self.driver.find_element_by_id('last_name').send_keys('Test_last')

如你所见,比我想象的要容易...