How to access html content of AccessibilityNodeInfo of a WebView element using Accessibility Service in Android? -


i'm trying access textual content of app built using non-native(js+html) based framework.

hence, figured i'll try access data accessibility node corresponding webview element. however, i'm unable grab textual/html data using usual methods since methods gettext() work if native android element such textview, button etc.

public class myaccessibilityservice extends accessibilityservice {  @override public void onaccessibilityevent(accessibilityevent accessibilityevent) {     accessibilitynodeinfo accessibilitynodeinfo = accessibilityevent.getsource();     if (accessibilitynodeinfo == null) {         return;     }     int childcount = accessibilitynodeinfo.getchildcount();     (int = 0; < childcount; i++) {         accessibilitynodeinfo accessibilitynodeinfochild = accessibilitynodeinfo.getchild(i);         myrecursivefunc(accessibilitynodeinfochild);     } }  @override public void oninterrupt() {  }   private void myrecursivefunc(accessibilitynodeinfo accessibilitynodeinfochild) {     if (accessibilitynodeinfochild.getchildcount() > 0) {         (int j = 0; j < accessibilitynodeinfochild.getchildcount(); j++) {             accessibilitynodeinfo child = accessibilitynodeinfochild.getchild(j);             if (child != null) {                 myrecursivefunc(child);             }         }     } else {         if ("android.webkit.webview".equals(accessibilitynodeinfochild.getclassname())) {              //===========this webview's accessibilitynodeinfo !!!!             //===========how html data nodeinfo object here ??          }     } } 

}

does service have flag_request_enhanced_web_accessibility?

final accessibilityserviceinfo info = getserviceinfo(); info.flags |= accessibilityserviceinfo.flag_request_enhanced_web_accessibility; setserviceinfo(info); 

android's default accessibilityservice (talkback) requires able screen read text in webviews. examining source, appears there's script injection , hackiness in order able textual content of html elements

you should check out source:

talkbackservice

webinterfaceutils

processorwebcontent


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -