Dump elements in WebView

How to view all elements in WebView by using app.Query()?

Posts

  • curtisdieucurtisdieu USMember
    edited March 2015

    Not sure the exact reason for all elements in a WebView, but if you call app.repl() in a test. It will kick off a console application. The "tree" function can be called from any view and will display all elements from the current view.

    app.Query( c => c.All());

  • AlisonFernandesAlisonFernandes USMember ✭✭
    app.Query( v => v.WebView().Css("*"));
    

    Change the * to a to only get links you can interact with.

  • PhucThaiPhucThai USMember

    It can work, however the result is difficult to read and find a specific element.

    For Android, you can use Remote Debugging on Android with Chrome https://developer.chrome.com/devtools/docs/remote-debugging

    Steps with Android emulator, please look at the link for more details about version Chrome and Android
    1. Start app on emulator
    2. Open Chrome, and then type chrome://inspect

    Query element by using CSS selector, e.g.

    _app.Tap(c => c.WebView().Css("#element"));

Sign In or Register to comment.