Page 1 of 1

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

Posted: Tue Jun 09, 2020 11:48 am
by Patrick Hollerbach
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

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

Posted: Tue Jun 09, 2020 12:03 pm
by odklizec
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!