appium-inspector icon indicating copy to clipboard operation
appium-inspector copied to clipboard

feat: add functionality to search through app source tree

Open sudharsan-selvaraj opened this issue 1 year ago • 5 comments

Fixes https://github.com/appium/appium-inspector/issues/1004

Demo

https://github.com/appium/appium-inspector/assets/20136913/70ee6680-6504-47ac-83e3-bb1b32c709b1

sudharsan-selvaraj avatar Jun 07 '24 22:06 sudharsan-selvaraj

Thank you! Will test this a bit later. Similarly to your other PR, would it be possible to also update the documentation? I am referring to this page: https://appium.github.io/appium-inspector/latest/session-inspector/source/

  • Update the top two images
  • Add a new section in Application Source (between Refreshing the Source and Toggle Attributes Button)

Thanks for pointing out to the docs. I have updated all relevant images and added a new section with the gist of search functionality. Do let me know for any improvements.

sudharsan-selvaraj avatar Jun 08 '24 23:06 sudharsan-selvaraj

@sudharsan-selvaraj Would you have some time to finish this PR?

mykola-mokhnach avatar Aug 08 '24 21:08 mykola-mokhnach

@sudharsan-selvaraj Would you have some time to finish this PR?

@mykola-mokhnach Yup, I will be able to close the pending items.

sudharsan-selvaraj avatar Aug 08 '24 21:08 sudharsan-selvaraj

The good thing is that it does work in the Electron version now :) But I have some issues with the tree node text extraction:

  • It uses renderToString which is imported from react-dom/server, and as per React docs, it 'unnecessarily increases your bundle size and should be avoided'. There do seem to be alternatives but I haven't checked them in detail.
  • The converted node titles have additional wrapper text, which is unfortunately also taken into account when searching. For example, a node <android.widget.LinearLayout> would be converted to <span>&lt;<b class="_sourcetag_zwtnd_433">android.widget.linearlayout</b>&gt;</span>. Meaning, if I search for span, the entire DOM tree will be unwrapped, and potentially not a single node will be highlighted.

eglitise avatar Aug 19 '24 13:08 eglitise

I would also suggest exploring the idea of not converting the entire DOM upon every change in the search string. Maybe the raw title of each node can be calculated as part of recursive, or at least the DOM should be converted only once upon starting search.

eglitise avatar Aug 19 '24 13:08 eglitise

@sudharsan-selvaraj any updates on this PR ?

saikrishna321 avatar Dec 27 '24 06:12 saikrishna321

@sudharsan-selvaraj I will close this PR as it has been more than a year since its opening, but you are welcome to reopen it after resolving the merge conflicts and addressing the comments.

eglitise avatar Jun 25 '25 16:06 eglitise