1. 对webview页面元素的处理
self.driver.switch_to.context("WEBVIEW_com.aaa.bbb")
source = self.driver.page_source
print("订单支付页面>>",source)
print("context>>",self.driver.context) # WEBVIEW_com.aaa.bbb
print("contexts>>", self.driver.contexts) #native_app webview_com.aaa.bbb
allure.attach(source,"订单支付页面webview内容")
print("001>>",self.driver.find_element(By.XPATH,".//*/ul/li/p[1]").text)
print("002>>", self.driver.find_element(By.XPATH, ".//*/ul/li[1]").text) # 订单信息,总保费1300元
print("003>>", self.driver.find_element(By.XPATH, ".//*/ul/li/p/span").text)
2. 获取子元素文本
flipper_text = self.driver.find_element_by_android_uiautomator(
'new UiSelector().resourceId("com.aaa.bbb:id/view_flipper")'
'.childSelector(new UiSelector().className("android.widget.TextView"))')