-
Notifications
You must be signed in to change notification settings - Fork 568
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
Add execute driver #406
Add execute driver #406
Conversation
|
||
class ExecuteDriver(webdriver.Remote): | ||
|
||
def execute_driver(self, script, script_type='webdriverio', timeout=None): |
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.
timeout_ms might be a better arg name
self.driver.quit() | ||
|
||
def test_batch(self): | ||
script = """ |
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.
self.driver.execute_driver(script='return [];', script_type='webdriverio', timeout=10000) | ||
|
||
Return: | ||
Dir[str, any]: The result of the script. It has 'result' and 'logs' keys. |
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.
Dir -> Dict?
self.driver.execute_driver(script='return [];', script_type='webdriverio') | ||
self.driver.execute_driver(script='return [];', script_type='webdriverio', timeout=10000) | ||
|
||
Return: |
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.
d = get_httpretty_request_body(httpretty.last_request()) | ||
assert d['script'] == script | ||
assert d['type'] == 'webdriverio' | ||
assert 'timeout' not in d |
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.
'timeout' not in d.keys()
?
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.
Current way is fine
>>> d = {'timeout': 1}
>>> 'timeout' in d
True
>>> 'timeout' in d.keys()
True
""" | ||
|
||
result = self.driver.execute_driver(script=textwrap.dedent(script)) | ||
r = result.result[0].rect |
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's say it is a bit confusing to have result.result
mapping. What if we rename the retuned variable to response
?
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.
same below
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.
ah. Nice. Yeah, I forgot re-naming it
Waiting for appium/appium-base-driver#328
Added execute_driver as the new feature.
You can try the feature as
$ pytest test/functional/ios/execute_driver_tests.py
after applying the base driver PR on your local. I'll update this PR if something changes in the base driver PR.