简体   繁体   中英

Cant automate webview in hybrid appium test in python

I am trying to make a automatic test for the WEBVIEW part of my app. I can switch to the WEBVIEW context, but I cannot find the UI elements.

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

Here is the data of the textbox first_name :

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

So for you guys who might have the same problem, this is how it works for my hybrid app:

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

As you see, easier than i thought...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM