Forum Discussion

gracegift's avatar
gracegift
New Contributor
7 years ago
Solved

How to enter two integers using SetText method

I am using Python scripting with TestComplete and I am hitting an issue.  I have a textbox in which I would like to enter two numeric values separated by a comma (i.e., 35, 50).  The closest method I...
  • tristaanogre's avatar
    7 years ago

    I'm not incredibly familiar with python so the syntax may be off.  Basically, you're going to need to concatenate those as strings... yes, I know they are integers, but SetText takes a string parameter so you're going to need to convert them to strings and then concatenate the strings.

     

    It MIGHT look something like this

     

    def Test1():
    a = 35
    b = 50
    coords = aqConvert.IntToStr(a) + ','+aqConvert.IntToStr(b)
    Aliases.CoordinatesTextBox.SetText(coords)
  • tristaanogre's avatar
    tristaanogre
    7 years ago

    I THINK it would simply be something like below... again, I'm not extremely familiar with Python so, from the little I've gleaned, this SHOULD work.

     

    def Test1(xCord, yCord):
    coords = aqConvert.IntToStr(xCord) + ','+aqConvert.IntToStr(yCord)
    Aliases.CoordinatesTextBox.SetText(coords)