Find an element with xpath which can be a button OR a menuitem

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
User avatar
Patrick Hollerbach
Posts: 34
Joined: Thu Jan 02, 2014 4:00 pm
Location: Frankurt, Germany

Find an element with xpath which can be a button OR a menuitem

Post by Patrick Hollerbach » Tue Jun 09, 2020 11:48 am

Hi there,

we are creating automated tests for testing Microsoft Outlook.

We have troubles by runnig a test on a Microsoft Surface Book (which has a high resulution display).
We are clicking the button for creating a new meeting (see screenshot from spy in attachment).

This button is detected as button on our regular laptops. When executing this testcase on Surface Book, the button is not found. We checked it with Ranorex on the Surface Book: On this laptop it is not detected as button, it is a menuitem. See attached screenshot.
Same outlook version, different gui element on different hardware :-( Holy shit!

I need a solution to write a generic role in the rxpath instead of "button" or "menuitem". I tried to replace "button" with "element", but this doesn't work.

Any suggestions?

Regards
Patrick
You do not have the required permissions to view the files attached to this post.

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

Re: Find an element with xpath which can be a button OR a menuitem

Post by odklizec » Tue Jun 09, 2020 12:03 pm

Hi,

Could you please post a Ranorex snapshot (ideally, a snasphot for each state)? Screenshots are not so helpful ;) Anyway, what you can do is to replace exact element type with '*'. So the xpath could look like this:

Code: Select all

//*[@innertext='blablabla']
This should identify element, regardless of its type. But be careful about using such "shortcut"! This workaround could return multiple elements, instead of just one!
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