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.
Web test - Samples
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:
Use the FormFindChildClassName function to find the address box:
You can manipulate the address with the control functions:
Find the internet explorer control (within the form) with FormFindChildClassName and get the element object:
Use the ElementFindChild function to get the elements of the control and the element functions to automate the control:
Jenö Herget
Ranorex Team
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: Select all
form = Ranorex.FormFindTitle('Microsoft Internet Explorer',Ranorex.MATCH_SUBSTRING);
Code: Select all
addressBox = Ranorex.FormFindChildClassName(form, "Edit");
Code: Select all
Ranorex.MouseClickControl(addressBox);
Ranorex.ControlSetText(addressBox, 'http://www.google.com');
Ranorex.ControlSendKeys(addressBox, "{ENTER}");
Code: Select all
explorerControl = Ranorex.FormFindChildClassName(form, "Internet Explorer_Server");
explorerElement = Ranorex.ControlGetElement(explorerControl);
Code: Select all
# 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_PUSHBUTTON, 'Search');
Ranorex.MouseMoveToElement(googleSearchButton);
# Press the search button
Ranorex.ElementDoDefaultAction(googleSearchButton);
Ranorex Team