Selenium IDE with RadNumericTextBox

7 posts, 1 answers
  1. Maarten
    Maarten avatar
    4 posts
    Member since:
    Dec 2011

    Posted 16 Dec 2011 Link to this post

    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!
  2. Answer
    msigman
    msigman avatar
    141 posts
    Member since:
    Apr 2008

    Posted 25 Feb 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maarten
    Maarten avatar
    4 posts
    Member since:
    Dec 2011

    Posted 27 Feb 2012 Link to this post

    Thanks!
    Entering values to a RadNumericTextBox with Selenium now works :)

  5. msigman
    msigman avatar
    141 posts
    Member since:
    Apr 2008

    Posted 29 Feb 2012 Link to this post

    Glad to help!  Please feel free to link to or comment on the blog post mentioned above if you found it helpful.
  6. Praveen
    Praveen avatar
    1 posts
    Member since:
    May 2012

    Posted 23 May 2012 Link to this post

    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
  7. Christine
    Christine avatar
    1 posts
    Member since:
    May 2012

    Posted 22 Feb 2013 Link to this post

    Thanks! Help me solved the problem.
  8. Abhishek
    Abhishek avatar
    1 posts
    Member since:
    Oct 2013

    Posted 01 Oct 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017