22using FlaUI . Core . WindowsAPI ;
33using FlaUI . WebDriver . Models ;
44using System . Drawing ;
5- using System . Runtime . CompilerServices ;
65
76namespace FlaUI . WebDriver . Services
87{
@@ -25,10 +24,12 @@ public async Task ExecuteClickScript(Session session, WindowsClickScript action)
2524 {
2625 throw WebDriverResponseException . ElementNotFound ( action . ElementId ) ;
2726 }
27+ _logger . LogDebug ( "Clicking element {ElementId} with mouse button {MouseButton}" , action . ElementId , mouseButton ) ;
2828 Mouse . Click ( element . BoundingRectangle . Location , mouseButton ) ;
2929 }
3030 else if ( action . X . HasValue && action . Y . HasValue )
3131 {
32+ _logger . LogDebug ( "Clicking point ({X}, {Y}) with mouse button {MouseButton}" , action . X . Value , action . Y . Value , mouseButton ) ;
3233 Mouse . Click ( new Point { X = action . X . Value , Y = action . Y . Value } , mouseButton ) ;
3334 }
3435 else
@@ -42,6 +43,7 @@ public async Task ExecuteHoverScript(Session session, WindowsHoverScript action)
4243 {
4344 if ( action . StartX . HasValue && action . StartY . HasValue )
4445 {
46+ _logger . LogDebug ( "Moving mouse to ({X}, {Y})" , action . StartX . Value , action . StartY . Value ) ;
4547 Mouse . MoveTo ( action . StartX . Value , action . StartY . Value ) ;
4648 }
4749 else if ( action . StartElementId != null )
@@ -51,6 +53,7 @@ public async Task ExecuteHoverScript(Session session, WindowsHoverScript action)
5153 {
5254 throw WebDriverResponseException . ElementNotFound ( action . StartElementId ) ;
5355 }
56+ _logger . LogDebug ( "Moving mouse to element {ElementId}" , action . StartElementId ) ;
5457 Mouse . MoveTo ( element . BoundingRectangle . Location ) ;
5558 }
5659 else
@@ -60,11 +63,13 @@ public async Task ExecuteHoverScript(Session session, WindowsHoverScript action)
6063
6164 if ( action . DurationMs . HasValue )
6265 {
66+ _logger . LogDebug ( "Waiting for {DurationMs}ms" , action . DurationMs . Value ) ;
6367 await Task . Delay ( action . DurationMs . Value ) ;
6468 }
6569
6670 if ( action . EndX . HasValue && action . EndY . HasValue )
6771 {
72+ _logger . LogDebug ( "Moving mouse to ({X}, {Y})" , action . EndX . Value , action . EndY . Value ) ;
6873 Mouse . MoveTo ( action . EndX . Value , action . EndY . Value ) ;
6974 }
7075 else if ( action . EndElementId != null )
@@ -74,6 +79,7 @@ public async Task ExecuteHoverScript(Session session, WindowsHoverScript action)
7479 {
7580 throw WebDriverResponseException . ElementNotFound ( action . EndElementId ) ;
7681 }
82+ _logger . LogDebug ( "Moving mouse to element {ElementId}" , action . EndElementId ) ;
7783 Mouse . MoveTo ( element . BoundingRectangle . Location ) ;
7884 }
7985 else
0 commit comments