Skip to content

Conversation

@vinaghost
Copy link
Owner

@vinaghost vinaghost commented Sep 22, 2025

Yes, I use AI to generate the commit message, but I doubt it can fix the problem itself

Replaced direct XPath-based element retrieval with a new `GetElement` method, supporting both `By` selectors and `Func<HtmlDocument, HtmlNode?>` delegates. Updated `Click` and `Input` methods to accept `IWebElement` directly, reducing redundancy and improving maintainability.

Removed deprecated `WaitPageLoaded` and `WaitPageChanged` methods in favor of more generic `Wait` methods. Enhanced error handling with detailed messages for `WebDriverTimeoutException`. Updated the `Retry` class to include more descriptive timeout errors.

Refactored all commands to use the new `GetElement` method and streamlined interaction logic. Removed redundant code and unused methods, improving readability and maintainability. Updated the `IChromeBrowser` interface to reflect these changes.

Performed general code cleanup, including removing unused variables, redundant comments, and unnecessary method calls.
@vinaghost vinaghost self-assigned this Sep 22, 2025
@github-actions
Copy link

Version of this build is 2.12.79
Check download link here

- Added `[CallerArgumentExpression]` to `Wait` and `GetElement`
  methods for improved error reporting and debugging.
- Updated `Wait` in `ChromeBrowser.cs` to include better error
  handling and context in timeout exceptions.
- Modified `Click` to include a `Wait` call for ensuring specific
  conditions (e.g., visibility of the `logo` element).
- Added a new `GetElement` overload in `IChromeBrowser.cs`
  supporting `By` locators with `[CallerArgumentExpression]`.
- Updated `Wait` signature in `IChromeBrowser.cs` to align with
  the implementation in `ChromeBrowser.cs`.
- Introduced `IDelayService` in `LoginTask.cs` to add delays
  for smoother execution during the login process.
- Improved maintainability and reliability across the codebase
  by enhancing error handling and debugging capabilities.
Introduced a reusable `WaitPageChanged` method in `ChromeBrowser.cs`
and `IChromeBrowser.cs` to handle URL changes and ensure pages are
fully loaded. Updated various commands (`LoginCommand.cs`,
`HandleUpgradeCommand.cs`, `ToBuildingByLocationCommand.cs`,
`ToDorfCommand.cs`) to use this method after navigation actions.

Removed redundant `Wait` logic from the `Click` method in
`ChromeBrowser.cs`, consolidating it into `WaitPageChanged` for
better modularity. Enhanced error handling in `WaitPageChanged`
to provide detailed messages for failures.
@github-actions
Copy link

Version of this build is 2.12.80
Check download link here

Refactored the `BuildingsModified` method to improve readability
by reordering early exit checks and command executions.

In the `JobsModified` method, moved `_taskManager.AddOrUpdate`
for `UpgradeBuildingTask.Task` to the beginning of the method
to ensure proper task handling before other operations.

Removed redundant `_taskManager.AddOrUpdate` call at the end
of `JobsModified` to eliminate duplication and improve clarity.
@github-actions
Copy link

Version of this build is 2.12.81
Check download link here

Simplified the `Wait` method call by condensing the lambda
expression into a single line for better readability. Enhanced
the error message in the `if (result.IsFailed)` block to include
the `CurrentUrl` property, providing additional context for
debugging when the URL change wait fails.
@github-actions
Copy link

Version of this build is 2.12.82
Check download link here

@github-actions
Copy link

Version of this build is 2.12.83
Check download link here

asynchronous `GetElement` operation with a document parser
(`TrainTroopParser.GetTrainButton`) and a cancellation token.
@github-actions
Copy link

Version of this build is 2.12.84
Check download link here

Replaced the old `TrainTroopParser.GetTrainButton` logic with a more robust approach using `browser.GetElement` and a lambda function.
Enhanced error messages across the codebase for better clarity.
Refactored the `Retry` class to simplify and standardize error
handling using a new `Retry.Error` property. Introduced the
`WithError` method for chaining additional error context.

Improved logging to provide more context during execution,
including adventure details and specific failure points.
Simplified XPath handling by using `nodeGenerator` functions
for better readability. Updated tab index validation logic
in `SwitchTabCommand.cs` to ensure accurate error reporting.

Refactored exception handling in `ChromeBrowser` to use the
new `Retry.Error` mechanism. Removed redundant error-handling
methods and standardized error reporting with the
`Result.Fail(errors).WithError(...)` pattern.

Made namespace-specific changes to ensure consistency in
error handling and logging. Improved debugging support and
code readability by reducing redundancy and adding detailed
error messages. Added additional wait logic to enhance
automation reliability.
Refactored the `Skip` class to replace static error instances with a generic `Skip.Error` that supports dynamic error messages via the `WithError` method. Updated all references to use the new approach, enabling more descriptive and context-specific error handling. Removed redundant static `Skip` error instances to improve maintainability and reduce code duplication.
Refactored the error handling mechanism across the codebase to use
`WithError` and `WithErrors` methods for detailed and extensible
error messages.

- Replaced specific `Stop` error methods with a generic `Stop.Error`
  instance, allowing customization via `WithError`.
- Made `Stop` constructor private to enforce the use of `Error`.
- Updated `Skip` to include a default message and support `WithErrors`.
- Replaced hardcoded error messages in various files with the new
  `WithError` and `WithErrors` methods for better clarity.
- Removed redundant error methods like `JobNotAvailable` in
  `UpgradeBuildingError`.
- Improved error propagation in `NPCTask` and `UpgradeBuildingTask`.

These changes improve code maintainability and ensure consistent,
user-friendly error messages throughout the application.
@github-actions
Copy link

Version of this build is 2.12.85
Check download link here

@vinaghost vinaghost merged commit e265d4b into main Sep 29, 2025
4 checks passed
@vinaghost vinaghost deleted the changes/new-browser-interaction branch September 29, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants