I want to get text from browser by using
How can I do it?
I’ve parsed structure of
chrome and there is only
I’ve tried to use
getText() function, but it’s not helped.
Any help appreciated.
Maybe somebody know how can I do it by calling some chrome instance… or with any other method.
Any solution, with info, how to save android browser page as html/text will be enough, or how to select whole page. (except touching/long pressing text).
UiDevice.getLastTraversedText() is the only way I know to get highlighted text in webview. I am also looking for a better way to test webview on Android.
Weirdly, UiDevice.getLastTraversedText() has never worked for me. Since Android 4.4 though, the elements are exposed as the android.view.View with its text or function as content descriptors. Does not work all the time, but it is a large improvement.
use dumpWindowHierarchy() Method of UiDevice class to save current activity properities to file, the default location is “/data/local/tmp”.Then read that file using file operations.
Second way of getting current activity properities :
1. Use “adb shell uiautomator dump /data/local/tmp/view.xml” to get screen properities.
2. Pull the file to computer machine using adb pull command and read that file.