Page 1 of 1

Button control is invalid

Posted: Wed Aug 17, 2016 3:26 pm
by petercrowley
Hi All,

I am running a stress test that executes multiple steps 500 times/cycles.

One of the steps is to click a button control.

The test runs as expected for approximately 300-400 cycles then fails because the button control becomes invalid. The button control is visible on the screen but the ranorex report states that it is invalid.

The code is follows:

public static void selectBack()
{
UpperNavBarRepo.Instance.UpperNavBarButtonVar = "Back";
UpperNavBarRepo.Instance.HostServiceProvider.UpperNavBarButton.Click();
Delay.Seconds(2);
Report.Info("Back clicked");
}

Why does the button control suddenly become invalid?
What can cause a control to become invalid?
Is there anything I can do to make the control valid again?

Regards,
PC

Re: Button control is invalid

Posted: Thu Aug 18, 2016 12:26 pm
by odklizec
Hi,

I'm afraid, there is not enough information in your post to provide a reasonable answer. There are too many unknowns. Please answer the following questions...

Ranorex version?
Could you please post an exact error message you are getting when it fails (ideally post entire report)?
Could you please post the xpath behind the "UpperNavBarButton" element?
Also, please post a Ranorex snapshot of UpperNavBarButton element.

Additionally, add a step in your test to store snapshot of the parent element of UpperNavBarButton element, just before 'click' action. Then make sure the test ends execution after failure.
Once the test fails (due to invalid element), examine the snapshot of the parent element, if it contains the UpperNavBarButton element or not. If it does, examine its xpath, if it matches the one stored in repo or not.

Re: Button control is invalid

Posted: Mon Aug 22, 2016 5:02 pm
by petercrowley
Hi,

Please find the answers to your questions below:

1) What version of Ranorex?
5.4.5

2) Could you please post an exact error message you are getting when it fails?
See attached file, Ranorex Report.zip

3) Could you please post the xpath behind the "UpperNavBarButton" element?
container[@controlname='panelPages1']/container[@caption='Page' and @controltypename='Page' and @instance='0']//container[@controlname>$UpperNavBarButtonVar]

4) Post a Ranorex snapshot of UpperNavBarButton element.
See attached file, Back_Button_Snapshot.rxsnp

5) Add a step in your test to store snapshot of the parent element of UpperNavBarButton element, just before 'click' action.
See attached file, StressTests_20160819_145550_0_rxlog.zip

Regards,
Peter

Re: Button control is invalid

Posted: Thu Aug 25, 2016 1:47 pm
by Support Team
Hi Peter,

In order to analyze your issue in more detail, it would be great if you could send an email to [email protected] with a detailed description of your problem.

We can arrange a remote session if it's necessary.

I'm looking forward to your email.

Sincerely,
Matthias