Ranorex

Web test - Samples

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



Joined: 19 Jul 2006
Posts: 4

PostPosted: Mon Aug 21, 2006 2:09 pm    Post subject: Web test - Samples
Hi,
I was trying to test a webpage, and found that the control descriptions can not be used to recognise the objects.After reading through some posts in the forum, i understood that i need to use the element properties for that.Could it be possible that a sample script written in Python be made available for web testing.I saw one for C#,but could not get to understand that too much.It would be very helpful if a sample script is available.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Tue Aug 22, 2006 12:54 pm    Post subject:
I made a new Python sample WebPageTest.py to demonstrate how to automate a simple web page.
It's similar to the .NET sample RanorexVS2005Sample5.
The sample uses the Element functions to automate controls in Internet Explorer.
You can find the sample in the V0.9.3-Beta2 Version:

http://www.ranorex.com/download/Ranorex-0.9.3-Beta2.zip

Here are some useful tips:

Use the FormFind function to find the Internet Explorer application:

Code: click into code to enlarge
form = Ranorex.FormFindTitle('Microsoft Internet Explorer',Ranorex.MATCH_SUBSTRING);

Use the FormFindChildClassName function to find the address box:

Code: click into code to enlarge
addressBox = Ranorex.FormFindChildClassName(form, "Edit");

You can manipulate the address with the control functions:

Code: click into code to enlarge
Ranorex.MouseClickControl(addressBox);
Ranorex.ControlSetText(addressBox, 'http://www.google.com');
Ranorex.ControlSendKeys(addressBox, "{ENTER}");

Find the internet explorer control (within the form) with FormFindChildClassName and get the element object:

Code: click into code to enlarge
explorerControl = Ranorex.FormFindChildClassName(form, "Internet Explorer_Server");
explorerElement = Ranorex.ControlGetElement(explorerControl);

Use the ElementFindChild function to get the elements of the control and the element functions to automate the control:

Code: click into code to enlarge
# Find the search edit box
googleEditBox = Ranorex.ElementFindChild(explorerElement,Ranorex.ROLE_SYSTEM_TEXT, 'Search')                                             
# Set the text of the search edit box
Ranorex.ElementSetValue(googleEditBox, 'Ranorex');

# Find the search button
googleSearchButton = Ranorex.ElementFindChild(explorerElement,Ranorex.ROLE_SYSTEM_PUSHBUTTO N, 'Search');
Ranorex.MouseMoveToElement(googleSearchButton);
# Press the search button
Ranorex.ElementDoDefaultAction(googleSearchButton);

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



Joined: 19 Jul 2006
Posts: 4

PostPosted: Wed Aug 23, 2006 6:32 am    Post subject:
Thank you very much.This could be very helpfull.I will use the Beta that you have provided.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython 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