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

Only able to take a screenshot when using just webdriver. #363

Open
CalumR23 opened this issue Feb 2, 2023 · 3 comments
Open

Only able to take a screenshot when using just webdriver. #363

CalumR23 opened this issue Feb 2, 2023 · 3 comments

Comments

@CalumR23
Copy link

CalumR23 commented Feb 2, 2023

Hello I am trying to test out aShot and it only works when I use just webdriver. When trying the viewport scrolling:
Screenshot myScreenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(100)).takeScreenshot(webDriver);
I get the below error:
java.lang.Exception: org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String; at ru.yandex.qatools.ashot.util.InnerScript.execute(InnerScript.java:27) at ru.yandex.qatools.ashot.shooting.ViewportPastingDecorator.getFullHeight(ViewportPastingDecorator.java:67) at ru.yandex.qatools.ashot.shooting.ViewportPastingDecorator.getScreenshot(ViewportPastingDecorator.java:41) at ru.yandex.qatools.ashot.shooting.ViewportPastingDecorator.getScreenshot(ViewportPastingDecorator.java:35) at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:145)
I am confused on what exactly is going on and have updated all my dependencies to match the current version required by aShot/
Thank you for your time on this.

@valfirst
Copy link
Collaborator

valfirst commented Feb 2, 2023

@CalumR23 do you have full exception stacktrace? or any other details? it's hard to imagine what's happened

@CalumR23
Copy link
Author

CalumR23 commented Feb 2, 2023

@valfirst the only code that works is:
Screenshot myScreenshot = new AShot().takeScreenshot(webDriver);
Whenever I add a ShootingStrategy to it or webElement, I get the above error. I am running this thru inellij and even after running with --stacktrace its almost the same as above:
java.lang.Exception: org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String; at ru.yandex.qatools.ashot.util.InnerScript.execute(InnerScript.java:27) at ru.yandex.qatools.ashot.shooting.ViewportPastingDecorator.getFullHeight(ViewportPastingDecorator.java:67) at ru.yandex.qatools.ashot.shooting.ViewportPastingDecorator.getScreenshot(ViewportPastingDecorator.java:41) at ru.yandex.qatools.ashot.shooting.ViewportPastingDecorator.getScreenshot(ViewportPastingDecorator.java:35) at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:145) at com.liferay.poshi.runner.selenium.BaseWebDriverImpl.aShotAssertElementImage(BaseWebDriverImpl.java:2115)

BaseWebDriverImpl is the file I am creating the new aShot as shown above.

@CalumR23
Copy link
Author

CalumR23 commented Feb 3, 2023

Heres when using a webElement:
WebElement webElement = getWebElement(locator); Screenshot myScreenshot = new AShot().takeScreenshot(webDriver, webElement);
The error is :
java.lang.Exception: org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String; /opt/dev/projects/github/poshi-dev-tools/src/test/resources/poshiFiles/PoshiScriptTest.testcase[MyTest]:6 at ru.yandex.qatools.ashot.util.InnerScript.execute(InnerScript.java:27) at ru.yandex.qatools.ashot.util.JsCoords.findCoordsWithJquery(JsCoords.java:24) at ru.yandex.qatools.ashot.coordinates.JqueryCoordsProvider.ofElement(JqueryCoordsProvider.java:14) at ru.yandex.qatools.ashot.coordinates.CoordsProvider.ofElements(CoordsProvider.java:21) at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:116) at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:134)

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

2 participants