-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New content analyzis #233
New content analyzis #233
Conversation
Code is not final, this is more a proof of concept that we can find the currently displayed amazon product title.
3318485
to
189cda0
Compare
Rules (of new system): |
…o be able to analyse page content
I’ve just pushed a big refacto in order to take the direction decided in #234 and dis-moi/backend#448 Technical context :In current master version, simplified
Version proposed here The main work I did here (in 8ac3716 in particular) was to be able to analyze page content given a list of matching contexts to check. So, now, the
I do not use RN Headless task anymore, but it’s still there because I did not port all the functionality yet. Same for some other files, as FloatingModule, FloatingCoordinator, XPathModule … FunctionalWhat this version (also) brings
What this version missesA lot of things need to be «plugged back» :
Technical debtI’ve let a lot of
|
android/app/src/main/java/com/dismoi/scout/accessibility/BackgroundService.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/com/dismoi/scout/accessibility/BackgroundService.kt
Show resolved
Hide resolved
android/app/src/main/java/com/dismoi/scout/accessibility/BackgroundService.kt
Show resolved
Hide resolved
android/app/src/main/java/com/dismoi/scout/accessibility/BackgroundService.kt
Show resolved
Hide resolved
@JalilArfaoui You're describing interesting domain logic and mentionning resources in the PR description which would both deserve to appears somewhere in a markdown! |
You’re right @lutangar … I’ve added docs/Architecture.md that tries to sum up |
TLDR; Code is not final, this is more a proof of concept that we can find the currently displayed amazon product title.
Objective was to use accessibility service to extract current DOM from Chrome, to be able to apply XPath rule on live content.
After a lot of trials and reading, I failed to meet this main goal.
What I managed to do is to deep analyze the DOM, but exposed as a tree of
AccessibilityNodeInfo
. Tag names and classes are not exposed (every tag is exposed as an Android component,View
and so on …), but we seem to have the full hierarchy with ids and text contents.So, I manage to build a poc/feature that, whenever a product page is loaded in amazon (or when app becomes visible), irrespective of the URL, we can find the product title :
gives
Now, we need to discuss what’s the best strategy to replace or full XPath strategy :
- Keep current strategy (fetch current URL document in background and apply XPath on it)
- Replace with a mechanism to find more specific informations on more specific websites
- Both
- …
Used documentation and references :
- https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/ui/accessibility/services.html
- https://medium.com/nerd-for-tech/track-web-browser-usage-in-android-using-accessibility-service-800bfa2745d2
- https://stackoverflow.com/questions/33318083/how-to-get-webview-from-accessibilitynodeinfo
- https://groups.google.com/a/chromium.org/g/chromium-dev/c/2VC16XswAaI
- https://stackoverflow.com/questions/7282789/is-there-any-way-to-get-access-to-dom-structure-in-androids-webview
- https://stackoverflow.com/questions/40522043/how-to-access-html-content-of-accessibilitynodeinfo-of-a-webview-element-using-a
- https://stackoverflow.com/questions/65326148/why-accessibilityservice-failed-to-retrieve-content-of-a-webview-but-works-prop
- https://github.com/google/talkback
- https://github.com/chromium/chromium/blob/master/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java
- https://www.py4u.net/discuss/630533
- https://stackoverflow.com/questions/10634908/accessibility-and-android-webview
- https://stackoverflow.com/questions/36793154/accessibilityservice-not-returning-view-ids