Forum Discussion

SmartBST's avatar
SmartBST
Contributor
7 years ago

Click a string variable

Hi have created a variable string for an order # and i need to selected to be able to deleted.

 

How can I complete that .

 

 

Thank  you.

  • record the action to delete the variable. 


  • SmartBST wrote:

    Hi Robert

     

     

    Is a select control


     

    Typically, a select control will have a method called "ClickItem".  

     

    If I were to write it as code, I'd do something like this:

     

    var orderNumber = '12345';
    
    Aliases.MyApp.myForm.mySelectControl.ClickItem(orderNumber);

    For a text box, it's simply a matter of passing the variable to either the "Keys" or the "SetText" method.

     

    var orderNumber = '12345';
    
    // Keys method
    Aliases.myApp.myForm.myTextBox.Keys(orderNumber);
    
    //SetText method
    Aliases.myApp.myForm.myTextbox.SetText(orderNumber);

    If you're using Keyword Tests, the concept is the same.  When you select the appropriate method on your control (any one of the above 3 as described) you're prompted to enter the parameter value.  If you click the ellipses beside the parameter, you will bring up an edit window.

     

     

     

    This will allow you to select the mode of "Variable" and select which variable you want to use. This will work for ClickItem, SetText, or Keys.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What kind of control are you working with?  Is it a dropdown/select control? A check box? Radio button? Text field?  It really depends upon the kind of control as to what the correct process will be.

     

    What I would do, actually, is start first with recording the activity that you want to achieve.  Once that's done, go back to the recorded steps and find where the order string comes into play and add or adjust your code to use the contents of the variable appropriately.

     

    Without more specific information, there's very little additional help we can give. Sorry. :(

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        SmartBST wrote:

        Hi Robert

         

         

        Is a select control


         

        Typically, a select control will have a method called "ClickItem".  

         

        If I were to write it as code, I'd do something like this:

         

        var orderNumber = '12345';
        
        Aliases.MyApp.myForm.mySelectControl.ClickItem(orderNumber);

        For a text box, it's simply a matter of passing the variable to either the "Keys" or the "SetText" method.

         

        var orderNumber = '12345';
        
        // Keys method
        Aliases.myApp.myForm.myTextBox.Keys(orderNumber);
        
        //SetText method
        Aliases.myApp.myForm.myTextbox.SetText(orderNumber);

        If you're using Keyword Tests, the concept is the same.  When you select the appropriate method on your control (any one of the above 3 as described) you're prompted to enter the parameter value.  If you click the ellipses beside the parameter, you will bring up an edit window.

         

         

         

        This will allow you to select the mode of "Variable" and select which variable you want to use. This will work for ClickItem, SetText, or Keys.

    • SmartBST's avatar
      SmartBST
      Contributor

      Robert and i have another control that is a text field

      • Marsha_R's avatar
        Marsha_R
        Moderator

        SmartBST Screenshots of the object in question and the code that you've tried would help a lot.  We all test different applications in different languages and it's frustrating for us and you if we have to keep guessing at what the issue is.  Better to give us lots of information than very little.