为什么我点进有h5页面的,没有获取到webview
来源:1-18 原生app和H5进行相互切换代码实战

慕神6633432
2018-06-26
这个课程里下载的慕课APP,在虚拟机上操作,运行时候,手点进h5页面,但是获取不到webview,结果总是:['NATIVE_APP']。怎么能获取?
现在通过代码点进去结果是截图
运行结果一样总是:['NATIVE_APP']
def icon_close():
driver.find_element_by_id("cn.com.open.mooc:id/icon_close").click()
def later_btn():
driver.find_element_by_id("cn.com.open.mooc:id/positiveBtn").click()
def ask_btn():
img_elements = driver.find_elements_by_id("cn.com.open.mooc:id/iv_icon")
# print(len(img_elements))
img_elements[2].click()
def question_1():
questn_eles = driver.find_elements_by_class_name("android.widget.RelativeLayout")
# print(len(questn_eles))
questn_eles[0].click()
def get_web_view():
time.sleep(10)
webView = driver.contexts
print(webView)
driver = get_driver()
icon_close()
later_btn()
ask_btn()
question_1()
get_web_view()
1回答
-
Mushishi
2018-06-27
你好,你运用课程网盘里提供的慕课网app,运用的提供模拟器,这个是可以的。如果还有问题,你可以把运行截图和代码发一下。
042018-06-30
相似问题