Skip to content

Commit 35a97b7

Browse files
authored
Merge pull request #63 from FlaUI/add-windows-extensions-debug-logging
Add windows extensions debug logging
2 parents 73db943 + 01716db commit 35a97b7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/FlaUI.WebDriver/Controllers/ExecuteController.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
using FlaUI.Core.Input;
2-
using FlaUI.Core.WindowsAPI;
3-
using FlaUI.WebDriver.Models;
1+
using FlaUI.WebDriver.Models;
42
using FlaUI.WebDriver.Services;
5-
using Microsoft.AspNetCore.Authentication.OAuth.Claims;
63
using Microsoft.AspNetCore.Mvc;
74
using System.Diagnostics;
8-
using System.Drawing;
95
using System.Text.Json;
106

117
namespace FlaUI.WebDriver.Controllers

src/FlaUI.WebDriver/Services/WindowsExtensionService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using FlaUI.Core.WindowsAPI;
33
using FlaUI.WebDriver.Models;
44
using System.Drawing;
5-
using System.Runtime.CompilerServices;
65

76
namespace 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

Comments
 (0)