【问题标题】:Cant automate webview in hybrid appium test in python无法在python的混合appium测试中自动化webview
【发布时间】:2020-04-09 23:44:27
【问题描述】:

我正在尝试对我的应用程序的 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=""

【问题讨论】:

  • 你用的是模拟器还是真机?
  • 我现在使用的是真机。
  • 没人知道吗?

标签: python android mobile automated-tests appium


【解决方案1】:

所以对于可能有同样问题的你们来说,这就是我的混合应用程序的工作原理:

    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')

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

【讨论】:

    猜你喜欢
    • 2018-04-18
    • 1970-01-01
    • 1970-01-01
    • 2014-09-28
    • 2019-05-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-26
    • 1970-01-01
    相关资源
    最近更新 更多