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

Screenshot Error on some Browsers - Unable to locate the page area in the browser window screenshot #2444

Closed
rquellh opened this issue May 21, 2018 · 8 comments
Assignees
Labels
STATE: Need clarification An issue lacks information for further research.

Comments

@rquellh
Copy link

rquellh commented May 21, 2018

Are you requesting a feature or reporting a bug?

Bug

What is the current behavior?

When I upgrade to the latest TestCafe version (0.20.0) and I run tests with screenshots I get the following error in Chrome and Edge but not in Firefox.

Was unable to take a screenshot due to an error.

Unable to locate the page area in the browser window screenshot at <screenshot path>, because the page area mark with ID <ID number> is not found in the screenshot.

This was not an issue with these three browsers in 0.19.2.

It is odd that even though the error message states Was unable to take a screenshot due to an error. the screenshots are still in the screenshots folder.

What is the expected behavior?

I'm expecting the behavior to mimic Firefox with no errors.

How would you reproduce the current behavior (if this is a bug)?

  1. Download this repo
  2. npm install
  3. Run with the specified browsers
  • npm run test-chrome
  • npm run test-edge
  • npm run test-firefox

Provide the test code and the tested page URL (if applicable)

Tested page URL: www.github.com and www.google.com

Test code
see this repo

Specify your

  • operating system: Windows 10.0.0
  • testcafe version: 0.20.0
  • node.js version: node 8.9.3
  • chrome version: 66.0.3359.181
  • firefox version: 57.0.0
  • edge version: 17.17134.0
@AndreyBelym AndreyBelym added the STATE: Need clarification An issue lacks information for further research. label May 21, 2018
@AndreyBelym
Copy link
Contributor

Hi @rquellh! This is not an error, it's warning. Since v0.19.0 we implemented a cross-platform mechanism for removing browser UI controls from taken screenshots and capturing screenshots of specified elements. Before this TestCafe version, only screenshots taken in IE and Chrome didn't have browser UI elements. In v0.20.0 we introduced such warnings to give us debug information when TestCafe can't determine page's or element's area on a screenshot.

If you don't mind that screenshots of Firefox have browser UI like menus and bars, you can just ignore the warnings. But I suggest you to share the exact warning message and the taken screenshot to help me understand what's wrong in the captured image.

@mgasner
Copy link

mgasner commented May 22, 2018

is there any way to suppress these warnings?

@AndreyBelym
Copy link
Contributor

Unfortunately, there is no way to disable warnings yet.

@miherlosev
Copy link
Collaborator

The original question was answered. So I will close the issue.

@rquellh
Copy link
Author

rquellh commented Jun 7, 2018

Sorry for the delayed response. I have two concerns:

  1. I understand that this is a warning, but it's really odd to an end user to say Was unable to take a screenshot due to an error. , but then have the screenshot taken anyway.

  2. Also, the new warning is rejecting the promise, so before I was able to use the .then method and use the path argument. Now due to the warning the promise is being rejected.

sample use

t.takescreenshot().then(function(path){//do something with path})

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 24, 2019
@AndreyBelym AndreyBelym removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 26, 2019
@AndreyBelym
Copy link
Contributor

I apologize for a delayed response. I hope that my clarification still can be useful for someone:

  1. It is not an error, it's a warning. Errors force tests to fail, warnings don't. A warning is emitted due to a screenshot contains some parts that can cause some tests (e.g. visual regression tests) to fail. TestCafe doesn't delete incompletes screenshots since they can be very useful for debugging the screenshot cropping code.

  2. This takeScreenshot behavior is not documented. The return value of takeScreenshot must be undefined according to the docs, so the current behavior is a bug-like behavior.

2a. In this case takeScreenshot doesn't reject, it just resolves to null (otherwise a test would be marked as failed). It does this way since the taken screenshot is considered incomplete.

@maldzi
Copy link

maldzi commented Jun 7, 2021

I strongly ask for adding some way to supress these warnings. My Jenkins outputs look like a total mess.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jun 7, 2021
@aleks-pro
Copy link
Collaborator

Hello @maldzi,

Thank you for the feedback. There is an issue regarding your suggestion: #5544. You can follow it to be informed about our progress.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need clarification An issue lacks information for further research.
Projects
None yet
Development

No branches or pull requests

6 participants