Failed to take custom screenshot

255 views
Skip to first unread message

Sreejith Edayillam

unread,
Apr 17, 2017, 6:33:27 AM4/17/17
to getgauge
Hello,

We have implemented the custom screenshot Grabber in our Gauge automation but we alway get the regular screenshot. We are getting the following error for the custom screenshot failure.

[2017-04-17 18:27:59:430] [Thread-1] INFO BrowserManager - Reading https://chromedriver.storage.googleapis.com/ to seek [chromedriver]
[2017-04-17 18:28:02:517] [Thread-1] INFO BrowserManager - Latest version of [chromedriver] is 2.29
[2017-04-17 18:28:02:518] [Thread-1] INFO BrowserManager - Exporting webdriver.chrome.driver as /Users/sreejith/.m2/repository/webdriver/chromedriver/mac64/2.29/chromedriver
Starting ChromeDriver 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b) on port 15856
Only local connections are allowed.
Apr 17, 2017 6:28:03 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
[14.606][SEVERE]: Timed out receiving message from renderer: 1.000
[14.636][SEVERE]: Timed out receiving message from renderer: -0.031
set the timeout as 1 second
[15.641][SEVERE]: Timed out receiving message from renderer: 1.000
[15.643][SEVERE]: Timed out receiving message from renderer: -0.003
[16.648][SEVERE]: Timed out receiving message from renderer: 1.000
[16.650][SEVERE]: Timed out receiving message from renderer: -0.003
Failed to take Custom screenshot: com.gurutest.core.CustomScreenGrabber : timeout
  (Session info: chrome=57.0.2987.133)
  (Driver info: chromedriver=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.01 seconds
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'Admins-MacBook-Pro-5.local', ip: '10.41.121.160', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b), userDataDir=/var/folders/gs/9d9qw7f549b0hykhnfr3dt_00000gp/T/.org.chromium.Chromium.8fGbzD}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=57.0.2987.133, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 00130481bd7b3bece51d91302f238795
Capturing regular screenshot..

Please help us to resolve this error.

Thank You,
Sreejith

Srikanth V

unread,
Apr 19, 2017, 3:50:29 AM4/19/17
to getgauge
Hi,

Can you please share some code to illustrate how you have implemented the custom screenshot grabber? Also, which Gauge/language plugin versions are you on?

thanks
Srikanth

Sreejith Edayillam

unread,
Apr 19, 2017, 4:20:41 AM4/19/17
to getgauge
Hi Srikanth,

Thank you for responding my query.

Code:
public byte[] takeScreenshot() {
WebDriver driver = BasePage.browser;

Gauge.writeMessage("Failed URL: " + driver.getCurrentUrl());
return ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
}

Gauge version: 0.8.3


Plugins

-------

html-report (3.1.0)

java (0.6.2)


Thank You,
Sreejith

Srikanth V

unread,
Apr 19, 2017, 4:57:43 AM4/19/17
to getgauge
Hi,

Naive question, but can you ensure that the class containing this method implements ICustomScreenshotGrabber

Thanks
Srikanth

Sreejith Edayillam

unread,
Apr 19, 2017, 8:40:12 AM4/19/17
to getgauge
Hi Srikanth,

This is the class:

public class CustomScreenGrabber implements ICustomScreenshotGrabber {

Srikanth V

unread,
Apr 19, 2017, 1:21:15 PM4/19/17
to getgauge
Hi,

This looks like a potential issue with gauge-java. Your usage looks ok to me. Can you please raise an issue here: https://github.com/getgauge/gauge-java/issues/new ?

thanks
Srikanth

Srikanth V

unread,
Apr 20, 2017, 1:26:59 AM4/20/17
to getgauge
Hi,

On closer look, I think the culprit is this line from your stacktrace:

...

Failed to take Custom screenshot: com.gurutest.core.CustomScreenGrabber : timeout
  (Session info: chrome=57.0.2987.133)
  (Driver info: chromedriver=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.01 seconds
...

I tried a sample project with a custom screengrabber, and it seems to work. Can you please try with a simpler implementation? Something like this?

import com.thoughtworks.gauge.screenshot.ICustomScreenshotGrabber;
import com.thoughtworks.gauge.Gauge;

public class CustomScreenGrabber implements ICustomScreenshotGrabber {
public byte[] takeScreenshot() {
Gauge.writeMessage("Custom Screengrabber");
System.out.println("Custom Screengrabber");
return "".getBytes();
}
}



thanks
Srikanth

Sreejith Edayillam

unread,
Apr 20, 2017, 2:41:46 AM4/20/17
to getgauge
Thank You Srikanth.

Reported the issue.

Sreejith Edayillam

unread,
Apr 20, 2017, 7:34:58 AM4/20/17
to getgauge
Hi Srikanth,

Thank you for the information.

I tried again and  getting the screenshot. But still it capture only the visible area on webpage.

In selenium screenshot, we can get the complete page including the vertical scroll bar area (which is visible only on page scroll). Can you help to get a screenshot like that.

Thank You,
Sreejith.
Message has been deleted

Sreejith Edayillam

unread,
Apr 21, 2017, 5:51:15 AM4/21/17
to getgauge
Reply all
Reply to author
Forward
0 new messages