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

Selenium IDE with RadNumericTextBox

6 Answers 179 Views
Input
This is a migrated thread and some comments may be shown as answers.
Maarten
Top achievements
Rank 1
Maarten asked on 16 Dec 2011, 09:48 AM

Hi,


I use Selenium IDE 1.4.1 to test my website. This all works fine except for some specific Telerik input controls that are used. To be more specific, I cannot set values in the RadNumericTextBox (Telrik control) with Selenium IDE. Several topics are available where most of the time getEval with SetValue is proposed as a solution. However, none of the solutions work for me...Maybe somebody can put me on the right track?

The control in HTML looks like this: 
<td class="InputColumnField">
<span id="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_wrapper" class="RadInput RadInput_Windows7" style="white-space: nowrap;">
<input id="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_text" class="riTextBox riEnabled InputField" type="text" style="width:125px;" name="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_text" value="1" maxlength="2147483647">
<input id="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0" class="rdfd_" type="text" title="" value="1" style="visibility:hidden;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;">
<input id="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_Value" class="rdfd_" type="text" title="" value="1" name="ctl00$body$Development_userControl$ctl00$ntb__Stage_duration_input__1__0__0" style="visibility:hidden;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;">
<input id="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_ClientState" type="hidden" name="ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_ClientState" value="{"enabled":true,"emptyMessage":"","minValue":0,"maxValue":70368744177664}" autocomplete="off">
</span>
<span id="ctl00_body_Development_userControl_ctl00_ctl08" class="validation" style="display:none;"> Field is required.</span>
</td>

Proposed solution (in several threads):
<tr>
    <td>getEval</td>
    <td>this.page().getCurrentWindow()["ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_text"].SetValue(5);</td>
    <td></td>
</tr>

My basic Selenium command:
<tr>
    <td></td>
    <td>id=ctl00_body_Development_userControl_ctl00_ntb__Stage_duration_input__1__0__0_text</td>
    <td>2</td>
</tr>

This last option seems to put the value inside the textbox. However, this value is not saved. Also when you click on the control the "old" value shows up again (new value is removed).

Does somebody know the right commands and targets for Selenium IDE to deal with the RadNumericTextBox? 

Thanks!

6 Answers, 1 is accepted

Sort by
0
Accepted
msigman
Top achievements
Rank 2
answered on 25 Feb 2012, 07:41 PM
I had the same issue, but found a workaround.

Source and more information: http://www.msigman.com/2012/02/entering-radnumerictextbox-selenium-webdriver-1-6-0/ 

Solution:
Command: keyPress, Target: id=ctl00_ctl00_txtRecIDNum_text, Value: \97
Command: type, Target: id=ctl00_ctl00_txtRecIDNum_text, Value: 123456789
Command: fireEvent, Target: id=ctl00_ctl00_txtRecIDNum_text, Value: blur
0
Maarten
Top achievements
Rank 1
answered on 27 Feb 2012, 09:14 AM
Thanks!
Entering values to a RadNumericTextBox with Selenium now works :)

0
msigman
Top achievements
Rank 2
answered on 29 Feb 2012, 09:19 PM
Glad to help!  Please feel free to link to or comment on the blog post mentioned above if you found it helpful.
0
Praveen
Top achievements
Rank 1
answered on 23 May 2012, 06:22 AM
Hello misigman/Maarten
                           i am facing the same problem could you guys please tell me how to use these three lines in my Junit Code with RC

or you guys can share your code throw  which i can undersatnd and solve my problem


Thanks

Praveen
0
Christine
Top achievements
Rank 1
answered on 22 Feb 2013, 04:14 PM
Thanks! Help me solved the problem.
0
Abhishek
Top achievements
Rank 1
answered on 01 Oct 2013, 01:58 PM
Hi All,


If you want the enter a numeric data to a text box which do not accept string value:
[In this case I am targeting on KandoUI for numerictextbox]

This what I got after trying many combination:(I am using Selenium webdriver along with Eclipse)

public static void shouldFilterByRequestID(String requestID, WebDriver driver) throws Exception
{
int lengthOfRequestId = requestID.length();
for(int i =0 ; i<lengthOfRequestId;i++)
{
char currentCharacter = requestID.charAt(i);
System.out.println(currentCharacter);
switch (currentCharacter) 
{
case '0':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD0);
break;
case '1':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD1);
break;
case '2':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD2);
break;
case '3':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD3);
break;
case '4':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD4);
break;
case '5':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD5);
break;
case '6':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD6);
break;
case '7':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD7);
break;
case '8':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD8);
break;
case '9':
driver.findElement(By.xpath("//div[@class='k-animation-container']/form/div[1]/span[2]/span/input[2]")).sendKeys(Keys.NUMPAD9);
break;
default:
throw new Exception();
}
}
}

please let me know if any thing simpler is there.
Tags
Input
Asked by
Maarten
Top achievements
Rank 1
Answers by
msigman
Top achievements
Rank 2
Maarten
Top achievements
Rank 1
Praveen
Top achievements
Rank 1
Christine
Top achievements
Rank 1
Abhishek
Top achievements
Rank 1
Share this question
or