repo item info reporting exists timeout when it is present

Ask general questions here.
sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

repo item info reporting exists timeout when it is present

Post by sstowe » Thu Jun 28, 2018 7:34 pm

I have a page that contains

Code: Select all

        public void RemoveWidgets()
        {
           BottomLineII.BottomLineIIRepository repo = BottomLineII.BottomLineIIRepository.Instance;

			while (repo.DigitalBanking.WidgetHeaderHomeBaseAnyWidget.OpenWidgetMenuGearInfo.Exists(TimeSpan.FromSeconds(2)))
			{
				repo.DigitalBanking.WidgetHeaderHomeBaseAnyWidget.OpenWidgetMenuGear.Click();
				repo.DigitalBanking.WidgetHeaderHomeBaseAnyWidget.WidgetMenu_Remove.Click();
			}
            
        }
I have the browser window in question open and can SEE the item on the screen. When I highlight the OpenWidgetMenuGear element from the repo spy, highlighted correctly. When I run this code, the while loop is never returning true, and a watch on repo.DigitalBanking.WidgetHeaderHomeBaseAnyWidget.OpenWidgetMenuGearInfo.Exists() shows timeout.

Can anyone think of what I might be doing wrong? Thanks

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

Re: repo item info reporting exists timeout when it is present

Post by odklizec » Fri Jun 29, 2018 5:57 am

Hi,

2 seconds timeout is most probably too short for given element? Try to increase the timeout and I’m sure, it will find the element. You see, the speed of element search highly depends on the quality of xpath. If the xpath is not unique enough or too generic, it may take good few seconds to find the element. In this case, too short ‘Exists’ timeout could cause problems.
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

sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

Re: repo item info reporting exists timeout when it is present

Post by sstowe » Fri Jun 29, 2018 2:23 pm

Aha! I did not know this "You see, the speed of element search highly depends on the quality of xpath." I thought it was there or not there. You are a genius! Thanks.