Ask a Question

Size and Pos of Indicator

SOLVED
BenoitB
Community Hero

Size and Pos of Indicator

Hello,

 

I made a method for low-level click that works quite well unless under the Indicator.

I don't want to hide Indicator all time,  just hide it before clicking if click coordinates are under Indicator.

I didn't find the way to have size and pos of this Indicator so askting to Community.

 

My code:

 

/**
 * Click dans un objet via les méthodes Low Level
 * @author Biache Benoit
 * @memberof system
 * @function
 * @param {Object} Obj - Objet à cliquer, s'il n'est pas existant alors ignore le click
 * @param {number} [X=-1] - Position X du click depuis le bord gauche de l'objet, s'il est non défini ou défini à <b>-1</b> alors prend le milieu
 * @param {number} [Y=-1] - Position Y du click depuis le bord haut de l'objet, s'il est non défini ou défini à <b>-1</b> alors prend le milieu
 * @param {number} [Wait=200] - Durée en ms de l'appui sur le bouton gauche, la durée du relâchement est celle de l'appui / 2. Si elle n'est pas définie alors prend 200ms comme durée d'appui
 * @param {number} [Repeat=1] - Nombre de click à jouer. S'il n'est pas défini alors n'effectue qu'un clic
 */
function clickInObject(Obj, X = -1, Y = -1, Wait = 200, Repeat = 1) {
  if ((Obj == undefined) || (Obj == null) || ((Obj != null) && (!Obj.Exists)))
    return;
  X  = X == -1 ? Obj.Width >> 1 : X;
  Y  = Y == -1 ? Obj.Height >> 1 : Y;
  Xr = Obj.ScreenLeft + X;
  Yr = Obj.ScreenTop + Y;
  if (system.debug)
    Log.Message("clickInObject(Obj, " + X.toString() + ", " + Y.toString() + ", " + Wait.toString() + ", " + Repeat.toString() + ") - Click Low Level", "X reel = " + Xr.toString() + ", Y reel = " + Yr.toString() , pmLowest, system.logDebug);
  // Check if Indicator need to be hide 
  // if ...
  //   Indicator.Hide();
  for (let loop = 0; loop < Repeat; loop++) {
    LLPlayer.MouseDown(MK_LBUTTON, Xr, Yr, Wait);
    LLPlayer.MouseUp(MK_LBUTTON, Xr, Yr, Wait >> 1);
    aqUtils.Delay(100);
  }  
  // If Indicator was hidden, show it again
  Indicator.Show();
}

 

 

.

 

 

 

Un sourire et ça repart

7 REPLIES 7
Marsha_R
Champion Level 3

I would contact Support directly with that question.  They are more likely to know the specifics.  Here's the link:

https://support.smartbear.com/message/?prod=TestComplete

tristaanogre
Esteemed Contributor

No need to engage support in this case. 😉 

There's no way to adjust the size or position of the indicator.  What you are doing (calling the Hide() and Show() methods on the indicator object) is the best and only way currently to do what you want.  My suggestion would be to simply ALWAYS hide it when you're in that routine.  There's no real reason for it to be visible at that point and you're not hurting execution by doing so.



Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Support can still help if you do want to only hide it when you're dealing with that portion of the screen.  I understand that you may want it on in all other cases.

tristaanogre
Esteemed Contributor

Fair point... but it's in the upper right corner so it's going to be variable values based upon the executing screen resolution.  Currently, the object doesn't have any properties to return the location of that window so I'm guessing that, right now, there's no real way to control that.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

And so we let Support make a better guess I think.

Indicator is very useful.

But as we cannot change it position it can be problematic (top right level is mainly the place for profile access in lot of webapps for example).

Don't want to hide it everytime i call the click routine because it can make you blink a lot depending on your clicks.

So i'll add it in the features wanted list and i keep simple coordinates test until it would be done

 

  if ((Yr < 350) && (Xr > (Sys.Desktop.Width - 400)))
    Indicator.Hide();

Txs for confirming me there is no way to have object info on it.

 

Un sourire et ça repart

Hi,

 

Consider also this (https://community.smartbear.com/t5/TestComplete-Functional-Web/Win32API-Alternative-for-Script-Exten...) and this (https://community.smartbear.com/t5/TestComplete-Functional-Web/Modal-User-Forms-to-be-on-top-of-othe...)

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: