BugFix - 39427 - ByURL Locator Not Supported For CloseTabsExcept Operation#3761
Conversation
…if we use ByURL locator then it closes all the tabs. RC: Playwright driver didn't support 'By URL' locator for this action operation. Fix: Added implementation for 'By URL' locator.
WalkthroughThe latest changes in the Changes
Sequence Diagram(s)sequenceDiagram
participant Handler as ActBrowserElementHandler
participant Browser as Browser
participant Logger as Logger
Handler->>+Handler: HandleCloseTabExceptOperationAsync()
Note right of Handler: Check for supported locators
Handler->>-Browser: Get all tabs
alt Supported Locator
Browser-->>Handler: Tab Titles/URLs
Handler->>Handler: Filter tabs based on locator
else Unsupported Locator
Handler->>Logger: Log error message
end
Handler->>Browser: Close tabs except excluded one
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/ActionHandlers/ActBrowserElementHandler.cs (2 hunks)
Additional context used
Learnings (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/ActionHandlers/ActBrowserElementHandler.cs (1)
User: IamRanjeetSingh PR: Ginger-Automation/Ginger#3738 File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightBrowserTab.cs:72-77 Timestamp: 2024-06-07T20:51:31.445Z Learning: Error handling for the `GoToURLAsync` method in the `PlaywrightBrowserTab` class is managed in the parent method or surrounding context.
Additional comments not posted (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/ActionHandlers/ActBrowserElementHandler.cs (1)
3-3: Added a newusingdirective forAmdocs.Ginger.Common.UIElementto support new functionality.
| if (_act.LocateBy != eLocateBy.ByTitle && _act.LocateBy != eLocateBy.ByUrl) | ||
| { | ||
| throw new InvalidActionConfigurationException($"Error: Locator {_act.LocateBy} is not supported, use {eLocateBy.ByTitle} or {eLocateBy.ByUrl}."); | ||
| } | ||
|
|
There was a problem hiding this comment.
This update introduces robust validation for supported locator types (ByTitle and ByUrl) and improves error handling for missing window values. The method now differentiates how tab values are retrieved based on the locator type, which aligns with the PR objectives to support ByUrl for the CloseTabsExcept operation.
However, consider handling potential exceptions that might occur during the asynchronous operations within the loop (e.g., GetTitleAsync, GetURLAsync). This can ensure the stability of the application if any of these operations fail.
+ try
+ {
+ // Existing loop code here...
+ }
+ catch (Exception ex)
+ {
+ _act.Error = "An error occurred while processing tabs: " + ex.Message;
+ }Also applies to: 323-323, 326-333, 341-351
Thank you for your contribution.
Before submitting this PR, please make sure:
Summary by CodeRabbit
ByTitleorByUrl), providing more accurate operations.