Skip to content
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

snap step (in live mode) capturing whole web page instead of element #462

Closed
kensoh opened this issue Jun 21, 2019 · 2 comments
Closed

snap step (in live mode) capturing whole web page instead of element #462

kensoh opened this issue Jun 21, 2019 · 2 comments
Labels

Comments

@kensoh
Copy link
Member

kensoh commented Jun 21, 2019

As above, whole web page is captured in snapshot instead of only the web element. It could be due to change in Chrome browser behaviour in newer versions or some other reasons.

Bug first spotted - tebelorg/RPA-Python#7 (comment)

Minimum replication case - below works in TagUI normal mode but does not work in live mode.

https://google.com
snap //*[@name="q"] to q.png
@kensoh kensoh added the bug label Jun 21, 2019
@kensoh kensoh changed the title snap step (in live mode) capturing whole web page snap step (in live mode) capturing whole web page instead of element Jun 21, 2019
@kensoh kensoh added the feature label Jun 21, 2019
kensoh added a commit to tebelorg/TagUI that referenced this issue Jun 21, 2019
In newer DevTools Protocol, Page.captureScreenshot now supports clip parameter. This allows directly specifying the region to capture for a web element, instead of the previous implementation where a full screen is captured and then clipped as a PhantomJS webpage.

This improves performance as only the data of the selector snapshot is needed to be transferred between TagUI and Chrome instead of the whole webpage. Also, as PhantomJS is not involved, the quality and color would be more accurate without additional web profile of PhantomJS.

Lastly, this improvement also fixes an issue with snap step in live mode for Chrome, where the snapshot captures full screen instead of only the selector.
kensoh added a commit that referenced this issue Jun 21, 2019
In newer DevTools Protocol, Page.captureScreenshot now supports clip parameter. This allows directly specifying the region to capture for a web element, instead of the previous implementation where a full screen is captured and then clipped as a PhantomJS webpage.

This improves performance as only the data of the selector snapshot is needed to be transferred between TagUI and Chrome instead of the whole webpage. Also, as PhantomJS is not involved, the quality and color would be more accurate without additional web profile of PhantomJS.

Lastly, this improvement also fixes an issue with snap step in live mode for Chrome, where the snapshot captures full screen instead of only the selector.
@kensoh
Copy link
Member Author

kensoh commented Jun 21, 2019

Made a PR with below comment. It fixes this issue at the same time improve performance and quality of snap step when capturing snapshots from Chrome. Prior to packaged release, bug-fix & feature available from cutting edge version here - https://github.com/kelaberetiv/TagUI#set-up

In newer DevTools Protocol, Page.captureScreenshot now supports clip parameter. This allows directly specifying the region to capture for a web element, instead of the previous implementation where a full screen is captured and then clipped as a PhantomJS webpage.

This improves performance as only the data of the selector snapshot is needed to be transferred between TagUI and Chrome instead of the whole webpage. Also, as PhantomJS is not involved, the quality and color would be more accurate without additional web profile of PhantomJS.

Lastly, this improvement also fixes an issue with snap step in live mode for Chrome, where the snapshot captures full screen instead of only the selector.

@kensoh kensoh closed this as completed Jun 21, 2019
@kensoh
Copy link
Member Author

kensoh commented Jun 24, 2019

Adding an observation that Chrome taking snapshots in this way will momentarily show just the clipped area on the webpage, and showing blank on rest of page. After snapshot is done, it shows back the full webpage. This behaviour is a little unexpected.

Would think either not blanking rest of page, or blanking rest of page while retaining the clipped region, instead of bringing to top left of window. Looking forward to more data points from other users and perhaps other developers on this Chrome behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant