Page 1 of 1

repo item info reporting exists timeout when it is present

Posted: Thu Jun 28, 2018 7:34 pm
by sstowe
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

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

Posted: Fri Jun 29, 2018 5:57 am
by odklizec
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.

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

Posted: Fri Jun 29, 2018 2:23 pm
by sstowe
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.