-
-
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
[rb] add support for element screenshots #8533
[rb] add support for element screenshots #8533
Conversation
Please move the s/master/trunk update to a separate PR |
Will do. Sorry, it wasn't my intention to include that commit in this PR. |
b0a4a86
to
31a1c94
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.
@johndouthat this is great! thanks for noticing that it was missing and adding it.
I wonder if it would make sense to change the TakesScreenshot
module not to be namespaced by DriverExtensions
and instead make similar to SearchContext
so it can be included by both Driver & Element? Seems weird to have a module included by all of the supported drivers at this point. I don't love the idea of a conditional to toggle between #element_screenshot
and #screenshot
, but it seems less ideal to have essentially the same code in two places.
Regardless this is working and better than what we have, so +1.
@titusfortner Thanks for taking a look! OK, I've added a commit to extract |
Yes, I like this. I was trying to think if it made sense to have the conditional in the Does it make sense to have Also, please run @p0deje do you like this approach better than the first commit? A couple of the other |
I think the reason for driver extensions is to make driver augmentable so if new session returns "has_web_storage" in capabilities, we could include the related module in the driver. Similar to what an Augmenter does in Java. It was never really implemented so the driver extensions looked like simple modules to include. I'm fine with the changes though there might be client code that did something like this: driver.extend(Selenium::WebDriver::DriverExtensions::TakesScreenshot) In regards to |
Oh, yeah, dynamic adding of the extensions would make sense, and I didn't mean more changes in this PR. :) @johndouthat we'll also want the commits rebased/squashed and I'm not sure what Github does with the automatic actions when there is a merge commit. Let me know if you want help with the git part (you can also find me on Selenium Slack). |
@titusfortner we only have squash enabled for the repo when merging PRs. |
@diemol right, but this PR has a merge commit in it, so I'm not sure what that looks like with the automatic Github feature. Does it do the right thing automatically? I suppose I could try it out on a fork :) |
Yeah, a merge commit is still a commit, so it will get squashed with the other ones. |
Extracts TakesScreenshot from DriverExtensions to apply it to Element too
f9a8e7e
to
d6cf202
Compare
OK, I've removed the conditional toggle and protected method by moving |
Description
Adds support for taking screenshots of individual elements via the
session/:session_id/element/:id/screenshot
endpointMotivation and Context
Selenium::WebDriver::Remote::COMMANDS
already includes:take_element_screenshot
but theElement
class isn't wired up to use it. Python and Java Selenium bindings have this, and it would be nice to have it available in the Ruby bindingsTypes of changes
Checklist