Ranorex

Buttons within Buttons

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
Gryphyn



Joined: 07 Dec 2006
Posts: 15

PostPosted: Fri Dec 08, 2006 2:14 am    Post subject: Buttons within Buttons
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
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Fri Dec 08, 2006 12:31 pm    Post subject:
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
Back to top
View user's profile Send private message Visit poster's website
Gryphyn



Joined: 07 Dec 2006
Posts: 15

PostPosted: Sun Dec 10, 2006 10:46 pm    Post subject:
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
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sun Dec 10, 2006 11:54 pm    Post subject:
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
Back to top
View user's profile Send private message Visit poster's website
Gryphyn



Joined: 07 Dec 2006
Posts: 15

PostPosted: Mon Dec 11, 2006 12:33 am    Post subject:
Samples sent.
Let me know if you need more.

Cheers
Gryphyn
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Mon Dec 11, 2006 10:17 pm    Post subject:
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: click into code to enlarge
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}\nS tackTrace={3}\n",
                       e.Source, e.Control, e.Message, e.StackTrace);
    return 1;
}


Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Gryphyn



Joined: 07 Dec 2006
Posts: 15

PostPosted: Tue Dec 12, 2006 11:58 pm    Post subject:
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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum