QTP and ASP.NET.AJAX Input

3 posts, 0 answers
  1. Cathy
    Cathy avatar
    2 posts
    Member since:
    Jul 2012

    Posted 13 Sep 2012 Link to this post

    I am having one heck of a time getting QTP to play fair with these Telerik controls.  The most recent issue, being able to Set a value in an edit.  I can set the value using extra code but for some reason, when a search is invoked, it ignores the entered value and performs an open search.  Here's the QTP code including all the code lines that won't work :(.
        'Enter Branch Office name for LookUp
          '''vSearchedit = "name:=ctl00\$c\$NameTextBox
        Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Click
        Wait 1
        'Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Set brNameIn
        'Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Type brNameIn
        'Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Object.Value = brNameIn
        'Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Object.Click
     
    '   ''''have to use this ReplayType technique gotta love telerik
    Setting.WebPackage("ReplayType") = 2
        Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).set brNameIn
        Setting.WebPackage("ReplayType") = 1
     
        Wait 1
     
        Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Click
     
        Wait 1
     
        didSet = Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).GetROProperty("value")
        If didSet <> "" Then
            Wait 1
            'Press the Search button
            Browser(vBrowser).Page(vPage).WebButton("name:=Search").Click
        Else
            Reporter.ReportEvent micFail, "Set Entity Search", "Unable to set the search value.  Check your code!!!!"
            ExitTestIteration  
        End If

    Why in the world would QTP be able to see a value in the edit, but the value is ignored when the search is invoked?  It's not a problem with the search itself as it works if I manually enter my filter into the edit.  I am also including the source from the edit in question in case that might help...
    <span class="riSingle RadInput RadInput_Office2007" id="ctl00_c_NameTextBox_wrapper" style="width: 180px;"><input name="ctl00$c$NameTextBox" tabIndex="2" class="riTextBox riEnabled" id="ctl00_c_NameTextBox" style="width: 165px;" type="text" size="20" _events="[object Object]" control="[object Object]" RadInputValidationValue="" /><input name="ctl00_c_NameTextBox_ClientState" id="ctl00_c_NameTextBox_ClientState" type="hidden" autocomplete="off" value='{"enabled":true,"emptyMessage":"","validationText":"","valueAsString":""}' /></span>


    Thanks in advance,

    Cathy
  2. Cathy
    Cathy avatar
    2 posts
    Member since:
    Jul 2012

    Posted 14 Sep 2012 Link to this post

    My partner in crime figured this out so I'll post it as an FYI.  You have to use a .FireEvent "onmousover"  before setting the text value and that seems to set the hidden field which is really where the RadInput is pulling the data from.  Another entry for our Automation Knowledge Base...

    New code looks like this and it works every time...

    Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).FireEvent ("onmouseover")
    Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Click
    Browser(vBrowser).Page(vPage).WebEdit(vSearchEdit).Set brNameIn

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 18 Sep 2012 Link to this post

    Hi Cathy,

    Thank you for your update, it might help to the others forum members.

    I am not familiar with QTP automation testing but here are my 2 cents:
    This most probably happens because Click itself does not cause Focus of the control unless it is currently hovered.
    Using a .Focus instead of .Click, might work for putting the control in focus stage and allow its real edit value to be changed.
    Nevertheless you might want to blur the TextBox when clicking the Search. Or focus the Button (if the framework is not doing this automatically) on clicking as it would happens in real user experience.

    All the best,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top