Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to join two xpath expressions

27 views
Skip to first unread message

Sagar Mehta

unread,
Jan 11, 2025, 1:51:13 PMJan 11
to Automate for Android
Hello sir, i need to send early access of my content to the top daily viewers of my broadcast.
So when i open my daily viewers list (screenshot 1)
xpath :  /android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[@android:id='@android:id/content']/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager[@android:id='@sg.bigo.live:id/view_pager']/android.widget.RelativeLayout/android.widget.HorizontalScrollView[@android:id='@sg.bigo.live:id/tab_layout']/android.widget.LinearLayout/view[@class='androidx.appcompat.app.z$x' and @android:contentDescription='Daily']

i need to click on the viewer element (screenshot 2)
xpath : //androidx.recyclerview.widget.RecyclerView[@android:id='@sg.bigo.live:id/recycle_view']/android.widget.LinearLayout[{dailyviewer}][.//android.widget.TextView[@android:id='@sg.bigo.live:id/tv_value' and number(translate(@android:text, ',', '')) > 1000] ]

The problem i am getting is when i click on the viewers xpath it stars clicking on the elements in the hourly and weekly lists too.(scrrenshot3 and screenshot4).I need to bind the viewers xpath to the Daily xpath so that it only click the element under the daily list not under weekly or hourly lists.


Screenshot_2025.01.12_00.03.08.990.png
Screenshot_2025.01.11_23.41.32.101.png
Screenshot_2025.01.11_23.57.43.647.png
Screenshot_2025.01.11_23.41.47.684.png

Henrik "The Developer" Lindqvist

unread,
Jan 12, 2025, 8:39:02 AMJan 12
to Automate for Android
May be difficult since there probably no way to distinguish which tab/category, i.e. Hourly, Daily or Weekly, is currently "selected".
Try looking at the layout XML to see if there is way to do so, e.g. if it has an @android:checked="true" or similar.
If it does then simply include is as a predicate, i.e. within the [], e.g.
//androidx.recyclerview.widget.RecyclerView[@android:id='@sg.bigo.live:id/recycle_view']/android.widget.LinearLayout[{dailyviewer}][.//android.widget.TextView[@android:id='@sg.bigo.live:id/tv_value' and number(translate(@android:text, ',', '')) > 1000] ][/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[@android:id='@android:id/content']/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager[@android:id='@sg.bigo.live:id/view_pager']/android.widget.RelativeLayout/android.widget.HorizontalScrollView[@android:id='@sg.bigo.live:id/tab_layout']/android.widget.LinearLayout/view[@class='androidx.appcompat.app.z$x' and @android:contentDescription='Daily'] ]
Reply all
Reply to author
Forward
0 new messages