-
Notifications
You must be signed in to change notification settings - Fork 279
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
[1.11] Add the ability to screenshot individual elements on the page #553
base: 1.11
Are you sure you want to change the base?
Conversation
7dc110e
to
aea7f4d
Compare
This is probably still broken because width and height have to be ints, so you are just getting the top left corner position correct, but not the bottom right? |
Are you able to test the change I pushed up work, please, and confirm that all 4 things are floats (and not just degenerate floats with a .0), passed through to chrome? |
Tested, here is the data sample: dd($element->getClip());
Seems correct. (no fake floats) Thanks! |
That's a really simple but extremely useful feature 👍 |
The width and height look wrong. Surely those should also be fractional? |
@GrahamCampbell Sorry for asking, but what do you mean by saying "fractional" in this context? |
Fractional as in floats that are not ending in |
Awaiting reply from @osbre. |
@GrahamCampbell Did a test which confirmed that the width/height will be fractional if the element's width/height is explicitly set to a fractional number or is a percentage. $page->navigate($this->sitePath('fractional.html'))->waitForNavigation();
$element = $page->dom()->querySelector('#fractional');
self::assertEquals(90.5, $element->getClip()->getWidth()); <html>
<body>
<p id="fractional" style="color: red; width: 90.5;">
This element has a fractional width.
</p>
</body>
</html> Should I make it a test and include it in this PR? |
Note that currently, the position X and Y properties are not being recorded correctly because the type is
int
, while the original X and Y type can be float. This PR fixes it as well.