This is a migrated thread and some comments may be shown as answers.

RadWindow and Selenium

8 Answers 108 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 25 Mar 2009, 04:04 PM
Is there any way to set value to some radtextbox or another control inside radwindow using Selenium?
I need in my test press button which opens radwindow, set values to textboxes and click submit.
I can't get access to controls inside radwindow

8 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 30 Mar 2009, 11:46 AM
Hi Sergey,

You could use RadWindow's client-side api to get a reference to a control which is inside it.
$find('RadWindowClientID').get_contentFrame() method returns a reference to the IFRAME, in which the content page of the RadWindow is displayed. To gain access to the content page itself, you need to use its contentWindow property, e.g. $find('RadWindowClientID').get_contentFrame().contentWindow.

A simple step which simulates a click over a button should looks as the one below:
 getEval  $find('RadWindow1').get_contentFrame().contentWindow.$get("ButtonId").click()  

Let us know if you have any other questions.

Best wishes,
Petio Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Sergey
Top achievements
Rank 1
answered on 02 Apr 2009, 10:40 AM
We create test with .net driver and use ISelenium to control tests flow.
i am trying to get access to rad control in rad window and use

this.page().getCurrentWindow().GetRadWindowManager().getActiveWindow().get_contentFrame().contentWindow.$find('someControlIdLocatedInRadWindow')

and it says me there is no $find() in contex of value returned with contentWindow.

I call
ISelenium.RunScript() and use string above as parameter
0
Petio Petkov
Telerik team
answered on 06 Apr 2009, 03:13 PM
Hi Sergey,

Note that for this code to work the content page must be on the same server as the RadWindow - otherwise the browser's security mechanism will not allow you cross-browser scripting.

Sincerely yours,
Petio Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
manish
Top achievements
Rank 1
answered on 05 Jun 2009, 09:48 AM

I am trying to write values in zip masked telerik text box field using selenium ide and i am using getEval function and by following command ide is able to identify document.
document.getElementById('pldc_md1844_C_mc1844_ModuleModule_1844_InsuranceProviderComponent1_CompanyZipText')
But i am unable to write value using any function like: 
document.getElementById('pldc_md1844_C_mc1844_ModuleModule_1844_InsuranceProviderComponent1_CompanyZipText').set_Value("12345-6789");

Then it is displaying following error message: 
[error] Threw an exception: document.getElementById("pldc_md1844_C_mc1844_ModuleModule_1844_InsuranceProviderComponent1_CompanyZipText") is null

So please let me know how can i put values in this control.
0
Dimo
Telerik team
answered on 05 Jun 2009, 10:31 AM
Hi Manish,

It is recommended to set value to a RadMaskedTextBox (or any type of Telerik RadInput textbox) by using the control's API - obtain a reference to the textbox with $find("_control_client_id_here_") and then use set_value()

http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html

You can refer to the blog posts of one of our QA engineers for more information on this topic:

http://blogs.telerik.com/konstantinpetkov/posts.aspx

Regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
manish
Top achievements
Rank 1
answered on 05 Jun 2009, 04:44 PM
hi dimo

can you please elaborate your answer with example, that how can we do this. like i am using this line
i am using java script and in RC java language.

var dateInput = $find("RadMaskedTextBox2_text>");
and selenium ide throws following exception :
[error] Threw an exception: $find is not defined

Please help me out.

Thanks in advance

manish
0
manish
Top achievements
Rank 1
answered on 09 Jun 2009, 02:05 PM
Please reply me
0
Fiko
Telerik team
answered on 09 Jun 2009, 04:22 PM
Hi Manish,

It looks like the MS AJAX library is not loaded on the page. All ASP.NET AJAX controls, including RadControls are based on that library and they need it on the page. What happens is that when you try to execute the $find()(it is part of MS AJAX library) function in a earlier stage of the page life cycle, the library will still not be loaded on the page which will cause the error.
I suppose that you need to call JavaScript code from codebehind. In this case I believe that this blog post(you need to implement the described approach in Java yourself) will be of help.

Sincerely yours,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
Sergey
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Sergey
Top achievements
Rank 1
manish
Top achievements
Rank 1
Dimo
Telerik team
Fiko
Telerik team
Share this question
or