To find List text present in another List and then hover on its sibling to click on button

Ask general questions here.
alpesh.dhakad
Posts: 15
Joined: Wed Oct 31, 2018 2:10 pm

To find List text present in another List and then hover on its sibling to click on button

Post by alpesh.dhakad » Tue Jul 09, 2019 9:39 am

How to find List text present in another List and then hover on its sibling to click on button.

I want to find the list in which another list is present. In that list, I want to find text present in one of the container , after finding that container via text then I want to click on its sibling where a button is present.

Please help that from which method we could find that dropdown.

Refer snapshot and screenshot for your reference.
Attachments
List_Device_Snapshot_09_07_2019.rxsnp
List item snapshot
(3.61 MiB) Downloaded 4 times
List View.PNG
List view - Detectors Text
List View.PNG (7.95 KiB) Viewed 144 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: To find List text present in another List and then hover on its sibling to click on button

Post by odklizec » Tue Jul 09, 2019 11:33 am

Hi,

Well, in the structure of UI like this, it could be somewhat complicated to select a list item you want. Unfortunately, without seeing the UI in action, I can only show you some xpaths you may want to use. But I'm unable to tell how exactly to invoke the list item you want? This would need some experimentation with UI and Ranorex actions ;)

For example, you can use xpath like this, to localize the list item called '801 PS':
/form[@automationid='me']/progressbar/container[@automationid='PART_AutoHideControl']//button/list/listitem[@actualcaption='801 PS']
Where '801 PS' you can replace with variable. Now the question is, how to interact with such item, which may or may not be visible? So I would suggest to first try EnsureVisible, to bring the listitem in visible area of list. The problem is, that EnsureVisible may not actually work without expanding the list, containing such item? So you may need to expand the list. To localize expand button of list container containing item '801 PS', you can use xpath like this:
/form[@automationid='me']/progressbar/container[@automationid='PART_AutoHideControl']//button/list/listitem[@actualcaption='801 PS']/ancestor::container[@AutomationId='PART_ItemsPresenter']//container[@automationid='PART_DropDown']
Simply click the container 'PART_DropDown' and once expanded, try to use EnsureVisible.

Another possibility is to use PerfromClick action, which, unlike standard 'mouse click' action, does not need visible element you are going to click. The donwside of PerformClick is, that it does not trigger "on-mouse" click events, which may eventually be attached to the clicked items. Which means, the result of PerfromClick may not trigger events, which are triggered by standard mouse clicks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

alpesh.dhakad
Posts: 15
Joined: Wed Oct 31, 2018 2:10 pm

Re: To find List text present in another List and then hover on its sibling to click on button

Post by alpesh.dhakad » Wed Jul 24, 2019 2:04 pm

Extremely sorry for delayed response.

Thanks for solution. The below Xpath solution you provided is working but this is intermittent. Sometimes it works and sometimes it doesn't.
While trying with Spy, I am able to find it always but it is taking lot of time. Could you please help me to find any other way or more faster solution ?

"/form[@automationid='me']/progressbar/container[@automationid='PART_AutoHideControl']//button/list/listitem[@actualcaption='801 PS']/ancestor::container[@AutomationId='PART_ItemsPresenter']//container[@automationid='PART_DropDown']

Also, I would like to know how you have written Xpath for this, from where button is used before list. Which button ? Not able to understand this ? Please help /form[@automationid='me']/progressbar/container[@automationid='PART_AutoHideControl']//button/

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: To find List text present in another List and then hover on its sibling to click on button

Post by odklizec » Mon Aug 05, 2019 9:20 am

Hi,

I'm afraid, that without seeing your app, I'm unable to suggest more efficient (and faster to find) xpath. The UI contains lot of lists without unique IDs, so there is no way to point xpath to a particular list, which means that Ranorex needs to search all of them to find the particular list item.

The other xpath I suggested is for 'expand' button, belonging to List, which contains the list item you want to select. In some UIs, xpath may successfully find the listitem, but it may be impossible to click it without actually expanding the list. And this is where it may be useful to link the searched list item with parent list element and its expand button. Basically, the xpath searches the list item "801 PS" and then it goes up in the UI structure and locates expand button of its parent list element.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

alpesh.dhakad
Posts: 15
Joined: Wed Oct 31, 2018 2:10 pm

Re: To find List text present in another List and then hover on its sibling to click on button

Post by alpesh.dhakad » Fri Aug 09, 2019 12:09 pm

Hello,

Thanks for your solution. It is working mostly now as I have increased timeout for xpath.