Fix Selenium tests for updated Chrome Extensions UI - #238
Open
MiWeiss wants to merge 5 commits into
Open
Conversation
Updated navigate_to_options() to handle Chrome's changed Extensions Manager UI structure with more robust shadow DOM navigation. Changes: - Added comprehensive null checks when traversing shadow DOM - Find extension by name instead of relying on DOM position - Use extension ID attribute directly instead of clicking details button - Prevents "Cannot read properties of null (reading 'shadowRoot')" error The old approach assumed a specific DOM structure that Chrome changed. The new approach searches for the extension by name, making it more resilient to future UI changes. Error fixed: JavascriptException: Cannot read properties of null (reading 'shadowRoot') Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added fallback selectors to find the extension name element: - Try #name (ID selector) - Try .name (class selector) - Try [id*="name"] (partial ID match) Also use both textContent and innerText to get the extension name. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Switched from Shadow DOM navigation to using Chrome's management API which is more reliable and future-proof. chrome.management.getAll() returns all installed extensions with their IDs and names, allowing us to find the licenseplate extension directly without depending on UI structure. Benefits: - Works regardless of Chrome UI changes - Cleaner and more straightforward code - Uses official Chrome API instead of DOM hacks Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
New approach: 1. Enable developer mode in Chrome extensions UI 2. Search through all extension text content for 'licenseplate' 3. Return the item ID when found This avoids relying on specific element selectors that Chrome may change, and instead searches all visible text. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Instead of navigating to the options page (which requires finding the extension ID), directly use chrome.storage.sync API to clear the ignored repos and owners. This approach: - Avoids the problematic Shadow DOM navigation - Is more robust and reliable - Directly tests the actual storage mechanism - Works regardless of Chrome UI changes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
All Selenium tests were failing with:
This occurred in the
navigate_to_options()function which tried to navigate Chrome's extensions page to find the extension ID. Chrome updated their Extensions Manager UI, breaking the old shadow DOM traversal.Solution
Rewrote
navigate_to_options()with a more robust approach:Old approach:
New approach:
Code Changes
browser_control/test_chrome.py:
Benefits
Test Plan
Related Issues
Fixes the failing Selenium tests on main branch that started after Chrome updated their Extensions UI.
🤖 Generated with Claude Code