Switch to webview, the pagesource obtained is still a native element
See original GitHub issuehello, After clicking the element with flutter, switch to the webview page, you can switch normally, but the H5 element cannot be obtained, and the printed pagesource is also a native element。 My environment is Android 10, python, the following is the source code and the printed log: `class FlutterTest(unittest.TestCase): def setUp(self): desired_caps = {} desired_caps[‘platformName’] = ‘Android’ desired_caps[‘platformVersion’] = ‘10’ desired_caps[‘deviceName’] = ‘CLB0218904005263’ desired_caps[‘appPackage’] = ‘com.tencent.docs’ desired_caps[‘automationName’] = ‘Flutter’ desired_caps[‘appActivity’] = ‘com.tencent.docs.DocsFlutterActivity’ desired_caps[‘noReset’] = “True” desired_caps[‘recreateChromeDriverSessions’] = True desired_caps[‘chromeOptions’] = {‘w3c’: False} # desired_caps[‘enableWebviewDetailsCollection’] = True desired_caps[‘chromedriverExecutableDir’] = r’C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\79.0’
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
self.finder = FlutterFinder()
def test_flutter(self):
time.sleep(6)
finder = self.finder.by_text("test111")
text_ele = FlutterElement(self.driver, finder)
text_ele.click()
self.driver.switch_to.context('NATIVE_APP')
time.sleep(15)
print(self.driver.contexts)
contexts = self.driver.contexts
self.driver.switch_to.context('WEBVIEW_com.tencent.docs')
print(self.driver.context)
print(self.driver.page_source)
time.sleep(5)
windows = self.driver.window_handles
for window in windows:
time.sleep(5)
self.driver.switch_to.window(window)
if self.driver.title == 'test111':
break
print(self.driver.title)
time.sleep(5)
print(self.driver.page_source)
more = self.driver.find_element_by_class_name('mobile-component-star-v2 ')
more.click()
time.sleep(30)
def tearDown(self):
# self.driver.quit()
pass`
log:
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
+1
Move to => https://github.com/appium-userland/appium-flutter-driver/issues/45