Skip to content

when the Android webview have two html,the pageSource only response first html #6244

@a67c

Description

@a67c

Meta -

OS:
macOS 10.13.6

Browser:
chrome

problem -

when webview have more html,i only get the first html DOM,how i can get other html DOM and operate click on other html?
chrome inspect

From the chromelog i get three html page. the first is preload page,so it has no full DOM.
If i send websocket request ,i can get full DOM in the second HTML,but if i want to send tap to the second html in appium,the error is 'element is not attached to the page document'.
that is to say i only get the first html page source,eventhough i get seconde html full DOM tree by websocket request,I can't click it

Details

i find how to start chromedriver in appium log

./chromedriver --url-base=wd/hub --port=8000 --adb-port=5037 --verbose

send session request

url = "http://127.0.0.1:8000/wd/hub/session"
    params = {
        "desiredCapabilities": 
            {
            "chromeOptions": 
                {

                "androidUseRunningApp": True, 
                "androidDeviceSerial": "570ee645",
                "androidPackage": "com.tencent.mm",
                "androidProcess": "com.tencent.mm:tools", 
                }
            }
        }

and i can get the session information:

{
    u 'status': 0, u 'sessionId': u '63a37e204ab8219aaefb7047423522f1', u 'value': {
        u 'rotatable': False,
        u 'unexpectedAlertBehaviour': u '',
        u 'browserConnectionEnabled': False,
        u 'acceptSslCerts': True,
        u 'cssSelectorsEnabled': True,
        u 'chrome': {
            u 'chromedriverVersion': u '2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b)'
        },
        u 'javascriptEnabled': True,
        u 'version': u '57.0.2987.132',
        u 'databaseEnabled': False,
        u 'hasTouchScreen': True,
        u 'takesScreenshot': True,
        u 'platform': u 'ANDROID',
        u 'browserName': u 'chrome',
        u 'mobileEmulationEnabled': False,
        u 'nativeEvents': True,
        u 'applicationCacheEnabled': False,
        u 'webStorageEnabled': True,
        u 'pageLoadStrategy': u 'normal',
        u 'locationContextEnabled': True,
        u 'handlesAlerts': True,
        u 'takesHeapSnapshot': True
    }
}

and then send source request in chrome when the page rendering

http://127.0.0.1:8000/wd/hub/session/63a37e204ab8219aaefb7047423522f1/source

the chrome response as follows

{
sessionId: "63a37e204ab8219aaefb7047423522f1",
status: 0,
value: "<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" style="text-size-adjust: 100%;">

<head>
    <script type="text/javascript">
        var points = [];
        points[0] = new Date().getTime();
        var oldPoint = [];
        oldPoint[0] = new Date().getTime();
    </script>
    <meta charset="UTF-8" />
    <title>搜一搜</title>
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <link rel="stylesheet" type="text/css" href="dist/style.css?t=1531997024354" /> </head>

<body id="body" ontouchstart="">
    <div id="search_test" class="weui-cells" style="display:none;margin:0;z-index: 99">
        <div class="weui-cell weui-cell_select weui_select_before">
            <div class="weui-cell__hd">
                <select id="search_scene" class="weui-select"></select>
            </div>
            <div class="weui-cell__bd weui-cell__primary">
                <input id="search_input" class="weui-input" type="text" placeholder="请输入搜索词" /> </div>
            <div class="weui-cell__ft">
                <a id="search_btn" href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary">按钮</a>
                <a id="to_history" href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary">跳history</a>
            </div>
        </div>
    </div>
    <canvas id="canvas" style="display:none;"></canvas>
    <div id="app" class="result android">
        <div class="progress-bar">
            <span class="progress-bar__item" style="transform: translate3d(-100%, 0px, 0px);"></span>
        </div>
        <!---->
        <div class="suggestion-list is_android" style="display: none;">
            <div class="sug_wrp" style="height: 0px; opacity: 0;">
                <div class="suggestion-list-inner"></div>
            </div>
            <div class="sug_mask" style="display: none;"></div>
        </div>
    </div>
    <script src="dist/build.js?t=1531997024354"></script>
</body>

</html>",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions