You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type Consistency The type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
Type Consistency Similar to the chromium/service.py, the type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
Type Consistency The type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
Type Consistency The type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
Type Consistency The type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
Type Consistency The type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
Type Consistency The type hint for service_args was changed from List[str] to Sequence[str], but the setter method still checks if the value is an instance of Sequence. This could potentially allow non-list sequences (like tuples) which might not be intended. Consider enforcing List[str] if mutability is required.
-log_file = open(log_path, "wb") if log_path else None+try:+ log_file = open(log_path, "wb") if log_path else None+except IOError as e:+ log_file = None+ print(f"Failed to open log file {log_path}: {e}")
Apply this suggestion
Suggestion importance[1-10]: 9
Why: Adding error handling for file operations is crucial to prevent the program from crashing if the file cannot be opened, improving the robustness of the code.
9
Possible bug
Ensure "--websocket-port" is appended correctly to service_args
Modify the condition to check for the presence of "--connect-existing" in service_args to ensure it only appends "--websocket-port" when necessary, avoiding potential duplication or logic errors.
if "--connect-existing" not in self._service_args:
- self._service_args.append("--websocket-port")- self._service_args.append(f"{utils.free_port()}")+ self._service_args.extend(["--websocket-port", f"{utils.free_port()}"])
Apply this suggestion
Suggestion importance[1-10]: 8
Why: Using extend instead of multiple append calls ensures that the arguments are added in a single operation, reducing the risk of duplication and improving code readability.
8
Enhancement
Improve type hint specificity for the env parameter
Consider using a more specific type hint for env parameter in the constructor. Instead of Mapping[str, str], use Dict[str, str] which is more appropriate for environments that are expected to be mutable and directly accessible.
Why: Using Dict instead of Mapping can be more appropriate for environments expected to be mutable and directly accessible, enhancing code clarity and correctness.
7
Refactor command_line_args to use list comprehension for clarity and performance
Refactor the command_line_args method to use list comprehension for building the command line arguments, which can enhance readability and performance.
//py:common-edge-bidi-test/selenium/webdriver/common/bidi_tests.py FAILED in 2 out of 2 in 13.9s
Stats over 2 runs: max = 13.9s, min = 11.9s, avg = 12.9s, dev = 1.0s
/home/runner/.bazel/execroot/_main/bazel-out/k8-fastbuild/testlogs/py/common-edge-bidi-test/selenium/webdriver/common/bidi_tests.py/test.log
/home/runner/.bazel/execroot/_main/bazel-out/k8-fastbuild/testlogs/py/common-edge-bidi-test/selenium/webdriver/common/bidi_tests.py/test_attempts/attempt_1.log
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
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.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
according to feature request #12760
I did the work as in the pull request #12767.
Unfortunately, that pull request was closed due to inactivity and conflicts with the trunk branch.
I checked the build results and test execution here: https://github.com/iampopovich/selenium/actions/runs/9928825190/job/27425721756.
Motivation and Context
Types of changes
Checklist
PR Type
Enhancement
Description
List,Mapping,Optional, andSequencein the service classes.service_argswith_service_argsand added property methods for better encapsulation.command_line_argsmethods to use_service_argsin all service classes.Changes walkthrough 📝
service.py
Refactor Chromium service to use properties for service argumentspy/selenium/webdriver/chromium/service.py
List,Mapping,Optional, andSequence.service_argswith_service_argsand added property methods.command_line_argsmethod to use_service_args.service.py
Refactor Edge service to use properties for service argumentspy/selenium/webdriver/edge/service.py
Mapping,Optional, andSequence.service_argswith_service_argsand added property methods.service.py
Refactor Firefox service to use properties for service argumentspy/selenium/webdriver/firefox/service.py
Mapping,Optional, andSequence.service_argswith_service_argsand added property methods.command_line_argsmethod to use_service_args.service.py
Refactor IE service to use properties for service argumentspy/selenium/webdriver/ie/service.py
OptionalandSequence.service_argswith_service_argsand added property methods.command_line_argsmethod to use_service_args.service.py
Refactor Safari service to use properties for service argumentspy/selenium/webdriver/safari/service.py
List,Mapping,Optional, andSequence.service_argswith_service_argsand added property methods.command_line_argsmethod to use_service_args.service.py
Refactor WebKitGTK service to use properties for service argumentspy/selenium/webdriver/webkitgtk/service.py
List,Mapping,Optional, andSequence.service_argswith_service_argsand added property methods.command_line_argsmethod to use_service_args.service.py
Refactor WPEWebKit service to use properties for service argumentspy/selenium/webdriver/wpewebkit/service.py
List,Mapping,Optional, andSequence.service_argswith_service_argsand added property methods.command_line_argsmethod to use_service_args.