-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🚀 Feature] [py]: Better compatibility with Appium-python #14587
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
@p0deje @KazuCocoa what do you think of the changes, would love to get your feedback on this! |
@navin772 The changes look good to me, I only wonder if we need to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments.
I tried to integrate roughly a bit as https://github.com/appium/python-client/compare/selenium?expand=1
Thank you!
@KazuCocoa Thanks for the review, I have updated the PR with the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I left two comments.
I have also updated appium/python-client#1045 with this PR (and init_args_for_pool_manager
modification in this comment)
Co-authored-by: Kazuaki Matsuo <[email protected]>
@KazuCocoa updated the PR with the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM
cc @p0deje
py/test/selenium/webdriver/remote/remote_custom_locator_tests.py
Outdated
Show resolved
Hide resolved
extra_commands = {} | ||
|
||
@classmethod | ||
def add_command(cls, name, method, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to also allow defining custom methods to access these commands? That's what we do at least in Ruby
selenium/rb/spec/unit/selenium/webdriver/remote/bridge_spec.rb
Lines 42 to 51 in 2dcac9f
it 'adds new command' do | |
described_class.add_command(:highlight, :get, 'session/:session_id/highlight/:id') do |element| | |
execute :highlight, id: element | |
end | |
bridge.highlight('bar') | |
expect(http).to have_received(:request) | |
.with(:get, URI('http://localhost/session/foo/highlight/bar'), any_args) | |
end | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, i didn't notice here.
Maybe this is for https://github.com/appium/python-client/blob/7ac6bb833022b7dd6c753fd806904ab9f3e9fb79/appium/webdriver/extensions/log_event.py#L69-L70 which is a bit different from the ruby's one. Let me use this in appium/python-client#1045 later
The Ruby's one you thought is maybe https://github.com/appium/python-client/blob/7ac6bb833022b7dd6c753fd806904ab9f3e9fb79/appium/webdriver/webdriver.py#L65-L172
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what needs to be done here for python? I will implement it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/appium/python-client/blob/7ac6bb833022b7dd6c753fd806904ab9f3e9fb79/appium/webdriver/webdriver.py#L65-L172 this docstring's one. A user can add their arbitrary command as a new method. Personally, in Python's method, selneium's modification is not necessary since the style is giving each command class. A bit different from other bindings.
Hm, add_command
could be a public instance method for this usage so that users can give their defined executor.
e.g.
https://github.com/appium/python-client/pull/1045/files#diff-9eb2a344105c9330ef01acd17b3dc5ad00c9d2abc6422dbf3f63123ba48fc602
@patch("selenium.webdriver.remote.remote_connection.RemoteConnection._request") | ||
def test_execute_custom_command(mock_request, remote_connection): | ||
RemoteConnection.add_command("CUSTOM_COMMAND", "PUT", "/session/$sessionId/custom") | ||
mock_request.return_value = {"status": 0, "value": "OK"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know appium... but why are we using status
rather than HTTP codes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both seems similar, do you want me to use status_code
?
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
Fixes #13959
This PR implements extensibility points that would be useful in Appium-python client.
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
RemoteConnection
to support extra headers, custom user-agent, and additional HTTP commands.LocatorConverter
for flexible locator conversion logic.Changes walkthrough 📝
by.py
Add support for custom locator strategies
py/selenium/webdriver/common/by.py
locator_converter.py
Introduce LocatorConverter for custom locator conversion
py/selenium/webdriver/remote/locator_converter.py
LocatorConverter
class.remote_connection.py
Enhance RemoteConnection with custom headers and commands
py/selenium/webdriver/remote/remote_connection.py
webdriver.py
Enhance WebDriver with custom locators and elements
py/selenium/webdriver/remote/webdriver.py
LocatorConverter
for element finding.driver_element_finding_tests.py
Add tests for custom locator strategies
py/test/selenium/webdriver/common/driver_element_finding_tests.py
custom_element_tests.py
Add tests for custom web element classes
py/test/selenium/webdriver/remote/custom_element_tests.py
remote_custom_locator_tests.py
Add tests for custom locator conversion
py/test/selenium/webdriver/remote/remote_custom_locator_tests.py
remote_connection_tests.py
Add tests for RemoteConnection enhancements
py/test/unit/selenium/webdriver/remote/remote_connection_tests.py