Automate Android Facebook App - Empty <android.view.ViewGroup>

Hi Guys,

I try to automate android last version of Facebook app, but all I get is multiple Empty <android.view.ViewGroup> like this one in picture, this mean that I can’t select posts or get elements text or detect if it’s image post or video post …
Any help will be appreciated
Thanks

Appium version 1.10.0

Switch to web context. I bet this app is written using react native.

Thank you very much for this clarifications,
Yes effectively, first I stared with web context but unfortunately FB mobile in browser doesn’t show sponsored videos posts, they show only sponsored image and carousels … and that sponsored video are one of main needs of this project :persevere:

Is there any method to deal with that android react native apps ?
Thanks,

Have you found a solution yet?

You must use Xpath.
Watch Xpath Selenium tutorials on YouTube, I’m sure it will give you ideas to solve your problem

try with those caps added in you appium inspector:

“appium:settings[allowInvisibleElements]”: true,
“appium:settings[ignoreUnimportantViews]”: false,
“appium:settings[enableMultiWindows]”: true

I want to find the sponsored posts out of all the posts. I have attached the screenshot of it and its source code and associated tags and values in Appium inspector, but I can’t seem to find the word sponsored anywhere. How else can I filter out these type of posts?

https://drive.google.com/drive/folders/1hh2C5ykVpucTcEGRgf2e5LgdfjbCnFMS?usp=sharing

Thanks

That didn’t change anything for me.

My friend you should master Xpath 100.
In appium, I use the ID of my elements in the first case if they have an ID, and if they don’t, I create the Xpath for them manually.
ID is present 70% of the time

In the image you sent, Appium inspector has suggested the Xpath code in the red box that I have marked. If you think it is long, test the following code!

//android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]

I recommend that if you work with Appium, you must learn xpath professionally because with xpath you can click on any element you don’t even think about and get its 100% accurate position.

Below I have put some good resources for you to learn xpath (xpath in appium remains something like magic):





I recommend forget about xPath due to following reasona:

  • slow as hell with IOS
  • instability with any tiny app change.nightmare in support
  • inability to create search pattern in tons of way that can find Appium annotations.

Thanks, will surely learn more about it. Can we create xpath for something for which we don’t have the source code?

I see. Do you have any helpful suggestions on how I can solve the above issue?

if you or our team is not part of app who can set IDs for any elements needed - one of solution use partial text to find element.