美文网首页
iOS端单独启动wda 获取页面source

iOS端单独启动wda 获取页面source

作者: 进击的程序茗 | 来源:发表于2018-07-31 20:14 被阅读322次

    目的

    不通过appium直接启动wda并获取页面source控件树

    开启wda

    通过命令行开启:

    /usr/bin/xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=请传入设备的udid USE_PORT=8100 test
    

    开启iproxy 进行端口转发

    以8300端口代理8100端口

    iproxy 8300 8100 设备udid
    

    获取与wda通信session

    浏览器中访问

    http://localhost:8300/status
    

    返回信息如下 拿到session ID

    
    {
        sessionId: "97CC1D84-B3C4-467E-A1F2-BC004602DC72",
        value: {
            state: "success",
            os: {
                sdkVersion: "11.3",
                name: "iOS",
                version: "10.3.3",
            },
            ios: {
                ip: "172.24.34.73",
                simulatorVersion: "10.3.3",
            },
            build: {
                time: "Jul 31 2018 19:46:43"
            },
        },
        status: 0,
    }
    

    source请求

    http://localhost:8300/session/97CC1D84-B3C4-467E-A1F2-BC004602DC72/source
    

    即可获得与appium page_source一样的返回结果

    相关文章

      网友评论

          本文标题:iOS端单独启动wda 获取页面source

          本文链接:https://www.haomeiwen.com/subject/igqkvftx.html