Buttons within Buttons

Class library usage, coding and language questions.
Gryphyn
Posts: 15
Joined: Wed Dec 06, 2006 11:59 pm

Buttons within Buttons

Post by Gryphyn » Fri Dec 08, 2006 1:14 am

Ranorex 1.0.0 (.Net2.0)

In their infinite wisdom, our developers have created a form with Buttons as children of another button.

RanorexSpy can show me details of the child buttons, however the libraries cannot/donot detect this situation.

As it's our license agreement form, this poses a major problem for us.
(well there is XY coords - for a functional test)

O I agree
O I disagree

These two RadioButtons are children of a 'placeholder' button (I'm told something to do with enabling/disabling the [Next] button - that's their story)

--Is this a bug, or an enhancement? (feel free to move post)

Cheers
Gryphyn

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Fri Dec 08, 2006 11:31 am

Gryphyn wrote:RanorexSpy can show me details of the child buttons
If RanorexSpy can show you details, then you can find the button with the Find() functions.
Gryphyn wrote:These two RadioButtons are children of a 'placeholder' button
Find first the placeholder button in the form with the Form.FindButton() function.
You can then find the children with the Element.FindChild() functions.
Read the state with Element.GetState, check or uncheck the radio button with Element.DoDefaultAction or with Mouse.ClickElement.

See also the sample RanorexVS2005Sample3 in the Samples directory.

Jenö Herget
Ranorex Team

Gryphyn
Posts: 15
Joined: Wed Dec 06, 2006 11:59 pm

Post by Gryphyn » Sun Dec 10, 2006 9:46 pm

This is the point. The Find() functions are not finding the child-buttons.

I've done a full cascade of Element.FindChild(n) into Element.FindChild(n)
traversing from the main-form to every accessable child.
The Radio buttons do not appear in the list.

Even finding the 'container' button, then checking only for its decendants does not discover the RadioButtons. The container has a ChildCount of 0(zero)

Cheers
Gryphyn

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Sun Dec 10, 2006 10:54 pm

Interesting issue.
How do you search the radio buttons with FindChild()? Can you send me your source code please.
Please send me also the dialog or a sample with this problem if possible.
We haven't any known bug in 1.0.0 that may cause such a problem.

Jenö Herget
Ranorex Team

Gryphyn
Posts: 15
Joined: Wed Dec 06, 2006 11:59 pm

Post by Gryphyn » Sun Dec 10, 2006 11:33 pm

Samples sent.
Let me know if you need more.

Cheers
Gryphyn

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Mon Dec 11, 2006 9:17 pm

I think you should wait a little bit after clicking the Next button on the first wizard page (until the next page is ready).
The pages have the same title text and the same class name, so you should search every single page after cllicking the Next button.

I could automate the wizard as follows:
(Code without error handling)

Code: Select all

try
{
    // Searching the first wizard page
    Form form = Application.FindFormTitle("Title of the wizard page");
    // Searching and clicking the "Next" button
    Control nextButton = form.FindChildText("&Next >");
    Mouse.ClickControl(nextButton);

    // Waiting 1 sec for the second wizard page
    Application.Sleep(1000);
    form = Application.FindFormTitle("Title of the wizard page");
    // Searching and clicking the "I accept ..." button
    Control iAcceptButton = form.FindChildText("I &accept the license agreement");
    Mouse.ClickControl(iAcceptButton);

    // Waiting 1 sec until next button ready (enabled)
    Application.Sleep(1000);

    // Searching and clicking the "Next" button
    nextButton = form.FindChildText("&Next >");
    Mouse.ClickControl(nextButton);
    ...    
    Application.Sleep(2000);
    return 0;
}
catch (RanorexException e)
{
    Console.WriteLine("\nEXCEPTION\nSource={0}\nSender={1}\nMessage={2}\nStackTrace={3}\n", 
                       e.Source, e.Control, e.Message, e.StackTrace);
    return 1;
}
Jenö Herget
Ranorex Team

Gryphyn
Posts: 15
Joined: Wed Dec 06, 2006 11:59 pm

Post by Gryphyn » Tue Dec 12, 2006 10:58 pm

admin wrote:I think you should wait a little bit after clicking the Next button on the first wizard page (until the next page is ready).
The pages have the same title text and the same class name, so you should search every single page after cllicking the Next button.

I could automate the wizard as follows:
(Code without error handling)
<snip>

Jenö Herget
Ranorex Team
A delay was prudent.
The 'page' in question also has a .RTF document that gets loaded into a RichEdit control. This I/O was delaying the button creation. (~50-60ms)
I'm not happy placing 'generic' sleeps within my code, but I have managed to isolate this particular case, so the effect is now negligable.

Issue resolved - no further action.

Cheers
Gryphyn