selenium – How to extarct all andriod tag Or how to extract the value/string inside the content-desc in Beautifulsoup?

I want to parse the html(or andriod content?) from an mobile app, and i am doing something like

soup = BeautifulSoup(html_text, 'lxml')
print(soup)

and what i got is the following:

page =  <?xml version='1.0' encoding='UTF-8' standalone="yes" ?>
<hierarchy index="0" class="hierarchy" rotation="0" width="1080" height="2274">
  <android.widget.FrameLayout index="0" package="test.app" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2274]" displayed="true">
    <android.widget.LinearLayout index="0" package="test.app" class="android.widget.LinearLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2274]" displayed="true">
      <android.widget.FrameLayout index="0" package="test.app" class="android.widget.FrameLayout" text="" resource-id="android:id/content" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2274]" displayed="true">
        <android.widget.FrameLayout index="0" package="test.app" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2274]" displayed="true">
          <android.view.View index="0" package="test.app" class="android.view.View" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][10,224]" displayed="true">
            <android.view.View index="0" package="test.app" class="android.view.View" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][10,224]" displayed="true">
              <android.view.View index="0" package="test.app" class="android.view.View" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2274]" displayed="true">
                <android.view.View index="0" package="test.app" class="android.view.View" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][180,22]" displayed="true">
                  <android.view.View index="0" package="test.app" class="android.view.View" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][180,22]" displayed="true">
                    <android.widget.ImageView index="0" package="test.app" class="android.widget.ImageView" text="" resource-id="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[22,66][154,220]" displayed="true" />
                    <android.widget.ImageView index="1" package="test.app" class="android.widget.ImageView" text="" resource-id="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[198,77][880,209]" displayed="true" />
                  </android.view.View>
                  <android.widget.ImageView index="1" package="test.app" class="android.widget.ImageView" text="" resource-id="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[54,264][142,396]" displayed="true" />
                  <android.view.View index="2" package="test.app" class="android.view.View" text="" content-desc="store1" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[430,289][650,371]" displayed="true" />
                  <android.widget.ScrollView index="3" package="test.app" class="android.widget.ScrollView" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="true" selected="false" bounds="[0,440][1080,2102]" displayed="true">
                    <android.widget.Button index="0" package="test.app" class="android.widget.Button" text="" content-desc="num_10" resource-id="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[54,440][1026,608]" displayed="true" />
                    <android.view.View index="1" package="test.app" class="android.view.View" text="" content-desc="beetle" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[68,666][1011,770]" displayed="true" />
                    <android.widget.ImageView index="2" package="test.app" class="android.widget.ImageView" text="" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[68,770][15,823]" displayed="true" />
                    <android.view.View index="3" package="test.app" class="android.view.View" text="" content-desc="uk_man" resource-id="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[115,770][446,823]" displayed="true" />
                    <android.view.View index="4" package="test.app" class="android.view.View" text="" content-desc="store23" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[540,770][1012,823]" displayed="true" />
                    <android.view.View index="5" package="test.app" class="android.view.View" text="" content-desc="store3" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[54,940][540,992]" displayed="true" />
                    <android.view.View index="6" package="test.app" class="android.view.View" text="" content-desc="store4" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[714,940][750,992]" displayed="true" />
                    <android.view.View index="7" package="test.app" class="android.view.View" text="" content-desc="41" resource-id="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[750,925][816,1007]" displayed="true" />

I want to get all the content of “content-desc” any help? Thanks

Jeff

Leave a Comment