为什么我点进有h5页面的,没有获取到webview

来源:1-18 原生app和H5进行相互切换代码实战

慕神6633432

2018-06-26

http://img.mukewang.com/szimg/5b330d3f0001c6d213440725.jpg这个课程里下载的慕课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,运用的提供模拟器,这个是可以的。如果还有问题,你可以把运行截图和代码发一下。

0
4
Mushishi
回复
慕神6633432
不是等待的原因,看上面的回答。你仔细看一下找的逻辑章
2018-06-30
共4条回复

Python主讲移动端自动化测试框架Appium

APP自动化基础知识、po模型、关键字模型、服务自动化、持续集成

1508 学习 · 1333 问题

查看课程