-
Notifications
You must be signed in to change notification settings - Fork 3.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
Implement consume_user_activation() web driver components #40699
base: master
Are you sure you want to change the base?
Conversation
1cac50e
to
eb9278a
Compare
bc3e0bc
to
5cb66ef
Compare
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 think this is my only comment here?
self.webdriver = self.parent.webdriver | ||
|
||
def consume_user_activation(self): | ||
return self.webdriver.send_session_command("POST", "consume-user-activation") |
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 instead just add this as a method somewhere on the WebDriver library (in tools/webdriver
), rather than directly invoking the command?
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.
Specifically, you probably want something like:
wpt/tools/webdriver/webdriver/client.py
Lines 361 to 363 in 7dcb66e
@command | |
def maximize(self): | |
return self.session.send_session_command("POST", "window/maximize") |
And then this becomes:
return self.webdriver.send_session_command("POST", "consume-user-activation") | |
return self.webdriver.window.consume_user_activation() |
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.
Also, isn't the command window/consume-user-activation
?
def setup(self): | ||
self.webdriver = self.parent.webdriver | ||
|
||
def consume_user_activation(self): |
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.
Does this not need to take a context
argument, from tools/wptrunner/wptrunner/executors/actions.py
above? Because otherwise we're just outright ignoring the context
argument specified in testdriver.js
in the sole implementation.
self.webdriver = self.parent.webdriver | ||
|
||
def consume_user_activation(self): | ||
return self.webdriver.send_session_command("POST", "consume-user-activation") |
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.
Specifically, you probably want something like:
wpt/tools/webdriver/webdriver/client.py
Lines 361 to 363 in 7dcb66e
@command | |
def maximize(self): | |
return self.session.send_session_command("POST", "window/maximize") |
And then this becomes:
return self.webdriver.send_session_command("POST", "consume-user-activation") | |
return self.webdriver.window.consume_user_activation() |
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.
To summarise what I just posted:
- There's a
context
argument sometimes and not otherwise; it seems like you're currently just dropping it on the floor with the current implementation. I'd be happy to land this with nocontext
argument (after all, that matches the WebDriver UX), which avoids needing to change much aside from the changing the JS side. - Adding the command to the
webdriver
module.
Also, can you also add some test to /infrastructure/testdriver
to verify the testdriver
command works where expected?
The Anyway, yes! Let's get that context passed around!! |
8cf598e
to
4bdd889
Compare
it's plausible there's some magic somewhere, and I'm just unaware of it! digs around seemingly |
Co-authored-by: Sam Sneddon <[email protected]>
Co-authored-by: Sam Sneddon <[email protected]>
Co-authored-by: Sam Sneddon <[email protected]>
39b82ad
to
042bf2e
Compare
Matches the consume-user-activation WebDriver command, which corresponds to these steps in HTML: https://html.spec.whatwg.org/#consume-user-activation