Forum Discussion

salley's avatar
salley
Frequent Contributor
8 years ago

how to set a text in a search inputbox

i've a popup window and i need to search for a specific class and select it. then enter exposure and save it, when i record it, it works fine but doesn't work when i actually write the code. script is able to settext but when it clicks save the class code disappares, how do i set the value in that Class field

 

Set sPage=Sys.Browser("iexplore").Page("http://me-aptweb1/Affiliation/ClassList.aspx")
Set sPanel=sPage.Form("form1").Panel("UpdWindow").Table(0).Cell(1, 1).Frame("UpdWindow").Form("form1").Panel(2).Panel("content")
sPanel.Table("conForm_mainTbl").Cell(1, 1).Panel("ClassCd").Table(0).Cell(0, 0).Textbox("Input").SetText("2157 - Bottling All Ops and Rte Superv Drivers")
sPanel.Table("conForm_mainTbl").Cell(2, 1).Textbox("conForm_Exposure").SetText("150000")
sPanel.Panel(1).SubmitButton("conForm_btnSave").Click

 

 

12 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It's possible that the code for that component has some event tied to it for "onexit" or something like that.  So, if you don't actually click in the field and then click away, it's possible that the text never actually gets set.  Try changing "SetText" to "Keys" and see if that works better.

    • salley's avatar
      salley
      Frequent Contributor

      Right, it's more like a search field, as you start to type in recommended list of class codes displays in drop down, but if keyed in value i need to select the class from the list. that's the only way. i've tried your method, it does key in the value but doesn't get set. i've attached a screen shot

      thanks

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        In that case, using the Keys method, add [Enter]  at the end of the string.  This will send the Enter keystroke to the field after typing in the value.  I'm assuming that will, effectively, select the item.

         

        Alternative: Take another look at the methods available on the control. If it's a "Select" type web component or similar control, there may be a "ClickItem" method on it that might simplify things.  If not, I think the Enter key method will work.