botcity-dev/botcity-framework-core

[DesktopBot] Reference to last element found is lost when using methods to move or click relative

joao-voltarelli opened this issue · 0 comments

  • Description:
    When finding an element, the click and move methods use the coordinates of the found element as a reference. What is expected is that these methods use the last element found as a reference, until a new element is found.
    However, when using the methods to move to a given coordinate, the element reference is lost. Making the click and move methods consider the coordinates of the mouse position and not the coordinates of the last element found.

  • Steps to reproduce:

browse("https://www.google.com");
			
if(!find( "keyboard", 0.97, 10000)) {	notFound("keyboard");	return;}
click();
wait(2000);
			
clickRelative(100, 100);
wait(2000);
			
click();

The expectation is that the second click was made on the coordinates of the last element found. But after the clickRelative, what is being considered is the mouse position, so the second click is not made in the position that the element appears.

  • Possible solution:
    The framework has the lastElement object that contains the coordinates of the last element found. A possible solution may be to use this reference in the move and click methods, instead of using the references: this.x, this.y