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

No screenshots in 1.0.45 with Chrome driver #50

Closed
hwellmann opened this issue Apr 21, 2015 · 9 comments
Closed

No screenshots in 1.0.45 with Chrome driver #50

hwellmann opened this issue Apr 21, 2015 · 9 comments

Comments

@hwellmann
Copy link

After upgrading from 1.0.23 to 1.0.45, I no longer get any screenshots. I'm using the Chrome driver, configured via webdriver.driver in serenity.properties.

Stepping through the code, I can see that BaseStepListener.take() gets hit, but BaseStepListener.browserIsOpen() returns false, since proxiedWebDriver is null in WebDriverFacade so that no screenshot is taken.

I also observed two instances of WebDriverFacade being created, one for an empty/default driver (i.e. firefox) and another one for chrome, which might be the root cause - hope that helps.

@vikramvi
Copy link
Member

vikramvi commented May 5, 2015

Issue still exists with 1.0.47

console output

[main] WARN net.thucydides.core.webdriver.WebDriverFacade - Failed to take screenshot - driver closed already? (unknown error: cannot take screenshot
from unknown error: Failed to capture tab: unknown error
JavaScript stack:
Error: Failed to capture tab: unknown error
at checkForExtensionError (chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:14:17)
at Object.callback (chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:37:5)
at safeCallbackApply (extensions::sendRequest:21:15)
at handleResponse (extensions::sendRequest:73:7)
(Session info: chrome=42.0.2311.135)
(Driver info: chromedriver=2.15.322455 (ae8db840dac8d0c453355d3d922c91adfb61df8f),platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5 milliseconds
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'

Please have a look

Thanks & Regards,
Vikram

@wakaleo
Copy link
Member

wakaleo commented May 5, 2015

From the error message I think this is a Chrome or Chrome-driver related
issue. Could you see if screenshots work in raw Selenium (create a simple
test that opens a URL and takes a screenshot)?

On 6 May 2015 at 00:56, vikramvi notifications@github.com wrote:

Issue still exists with 1.0.47

console output

[main] WARN net.thucydides.core.webdriver.WebDriverFacade - Failed to take
screenshot - driver closed already? (unknown error: cannot take screenshot
from unknown error: Failed to capture tab: unknown error
JavaScript stack:
Error: Failed to capture tab: unknown error
at checkForExtensionError
(chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:14:17)
at Object.callback
(chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:37:5)
at safeCallbackApply (extensions::sendRequest:21:15)
at handleResponse (extensions::sendRequest:73:7)
(Session info: chrome=42.0.2311.135)
(Driver info: chromedriver=2.15.322455
(ae8db840dac8d0c453355d3d922c91adfb61df8f),platform=Mac OS X 10.9.5 x86_64)
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5 milliseconds
Build info: version: '2.45.0', revision:
'5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'

Please have a look

Thanks & Regards,
Vikram


Reply to this email directly or view it on GitHub
#50 (comment)
.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com


The dates for the 2014 BDD workshops have been scheduled! Check out our
upcoming BDD/TDD Master classes
http://wakaleo.com/training/testing-and-tdd-for-java-developers and
our Advanced
BDD Requirements Workshops
http://wakaleo.com/training/advanced-agile-requirements-workshop
, coming
soon to Sydney
http://wakaleo.com/training/testing-and-tdd-for-java-developers/public-courses
*
and *Melbourne
http://wakaleo.com/training/testing-and-tdd-for-java-developers/public-courses!


@vikramvi
Copy link
Member

vikramvi commented May 6, 2015

Hi John,

please find below 2 updates

UPDATE 1:

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class testDriver {

@Test
public void startSite(){
     String url = "https://lovemusic.se";
     WebDriver driver = new ChromeDriver();
     driver.get(url);
     String title = driver.getTitle();

     File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

    try {
        FileUtils.copyFile(scrFile, new File("screenshot.png"));
    } catch (IOException e) {

        e.printStackTrace();
    }

     System.out.println("The title of " + url + " is: " + title);
     driver.quit();
}

}

UPDATE 2:

But other observation is , say I've 70+ test case and only in some cases framework fails to take screen shot and not all cases.

Please let me know if I can debug further and give more info

Thanks & Regards,
Vikram

@wakaleo
Copy link
Member

wakaleo commented May 6, 2015

Could it be related to one of these issues?
https://code.google.com/p/chromedriver/issues/detail?id=513
https://code.google.com/p/chromedriver/issues/detail?id=1083

On 7 May 2015 at 02:02, vikramvi notifications@github.com wrote:

Hi John,

please find below 2 updates

UPDATE 1:

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class testDriver {

@test
public void startSite(){
String url = "https://lovemusic.se";
WebDriver driver = new ChromeDriver();
driver.get(url);
String title = driver.getTitle();

 File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

try {
    FileUtils.copyFile(scrFile, new File("screenshot.png"));
} catch (IOException e) {

    e.printStackTrace();
}

 System.out.println("The title of " + url + " is: " + title);
 driver.quit();

}

}

UPDATE 2:

But other observation is , say I've 70+ test case and only in some cases
framework fails to take screen shot and not all cases.

Please let me know if I can debug further and give more info

Thanks & Regards,
Vikram


Reply to this email directly or view it on GitHub
#50 (comment)
.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com


The dates for the 2014 BDD workshops have been scheduled! Check out our
upcoming BDD/TDD Master classes
http://wakaleo.com/training/testing-and-tdd-for-java-developers and
our Advanced
BDD Requirements Workshops
http://wakaleo.com/training/advanced-agile-requirements-workshop
, coming
soon to Sydney
http://wakaleo.com/training/testing-and-tdd-for-java-developers/public-courses
*
and *Melbourne
http://wakaleo.com/training/testing-and-tdd-for-java-developers/public-courses!


@vikramvi
Copy link
Member

vikramvi commented May 7, 2015

Hi John,

Sorry for not searching in bug list earlier.

You're absolutely right , it is issue with selenium itself
https://code.google.com/p/chromedriver/issues/detail?id=1083

Hopefully they will release a new version sooner.

Regards,
Vikram

@wakaleo
Copy link
Member

wakaleo commented May 7, 2015

Thanks Vikram for confirming this - I'll close this issue then.

@rakeshnambiar
Copy link

Is this issue resolved? I am not able to take the screenshot.
(Session info: chrome=58.0.3029.96)
(Driver info: chromedriver=2.29.461591 (platform=Windows NT 10.0.14393 x86_64)

chrome.switches=--disable-extensions,--test-type,--start-maximized,--incognito,--enable-automation

@wakaleo
Copy link
Member

wakaleo commented May 5, 2017

Yes, the latest version of Chrome works fine with Serenity 1.2.x

@Nolyurn
Copy link

Nolyurn commented Feb 23, 2018

Newbie to Selenium and Serenity,
I had the same problem using Serenity for steps but program as Selenium way.
It seem that using PageObject solved my problem.

See more about page object in Serenity documentation
http://thucydides.info/docs/serenity-staging/
And on github
https://github.com/serenity-bdd/serenity-documentation/blob/master/src/asciidoc/page-objects.adoc

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

No branches or pull requests

5 participants