zoukankan      html  css  js  c++  java
  • APP WebView

    import time
    from appium import webdriver
    
    desired_caps = {
                    'platformName': 'Android',
                    'deviceName': '30d4e606',
                    'platformVersion': '7.1.2',
                    'appPackage': 'io.appium.android.apis',
                    'appActivity': '.ApiDemos',
                    'unicodeKeyboard': True,
                    'resetKeyboard': True,
                    'noReset':True,
              #webview 需要使用的chromedriver
    "chromedriverExecutable" : "D:\driverschromedriver.exe" } driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) # 休眠五秒等待页面加载完成 time.sleep(2) print(driver.contexts) driver.find_element_by_android_uiautomator('new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("Views").instance(0))').click() driver.find_element_by_android_uiautomator('new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("WebView").instance(0))').click() print(driver.contexts) #获取当前页面上下文 contexts=driver.contexts #切进native 进行操作 driver.switch_to.context(contexts[1]) driver.find_element_by_id("i_am_a_textbox").send_keys("hahah") time.sleep(1) # driver.find_element_by_id("i am a link").click() # 切回native driver.switch_to.context(contexts[0]) title = driver.find_element_by_xpath("//android.widget.TextView[@text='Views/WebView']").text print(title)

    Appium中混合版app切换带来的问题总结

    https://blog.csdn.net/sunfengye/article/details/105564127

    chromdriver 下载地址 

    https://npm.taobao.org/mirrors/chromedriver/

  • 相关阅读:
    Redhat6 —— Yum详解
    jQuery——bind绑定多事件用法
    织梦之路——织梦自由列表页分页链接绝对路径化(SEO)
    PHP算法——等宽等像素值截取字符串
    PHP算法——文件大小排序(KB、MB、GB、TB)
    HDU 3647 Tetris
    HDU 2442 Bricks
    ZOJ 2112 Dynamic Rankings
    HDU 3001 Travelling
    HDU 3559 Frost Chain
  • 原文地址:https://www.cnblogs.com/lexus168/p/13941151.html
Copyright © 2011-2022 走看看