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

[Serenity Screenplay-Junit with Appium] ScreenshotException shows after clicking on Button #2757

Closed
ldt0589 opened this issue Mar 26, 2022 · 5 comments · Fixed by #2768
Closed

Comments

@ldt0589
Copy link

ldt0589 commented Mar 26, 2022

I'm using:

Serenity-core 3.2
Serenity Screenplay 3.2
Junit 5

My code:

        String xpath = "//android.widget.ImageView[@content-desc="nLike"]/android.view.View";
        Target target = Target.the("button Like").located(By.xpath(xpath));
        WaitUntil.the(xpath, isClickable());
        actor.attemptsTo(Click.on(target));

In Serenity.conf:

serenity {
	test.root = starter
	compress.filenames = false
	take.screenshots = FOR_EACH_ACTION
}

I always get the ScreenShot Exception after clicking Like button successfully (actor.attemptsTo(Click.on(target))).
Please help to resolve this issue.

org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken

wakaleo added a commit that referenced this issue Mar 26, 2022
@wakaleo
Copy link
Member

wakaleo commented Mar 26, 2022

This is a Selenium error of some kind. Version 3.2.2 will include a work-around to catch and report this error as a warning message.

@wakaleo
Copy link
Member

wakaleo commented Mar 26, 2022

Disable the screenshots or wait for version 3.2.2. Or figure out why Selenium/Appium is reporting an error.

@ldt0589
Copy link
Author

ldt0589 commented Mar 26, 2022

Disable the screenshots or wait for version 3.2.2. Or figure out why Selenium/Appium is reporting an error.

An application's popup will display right after clicking the Button. Button is hidden and cannot capture xpath of button element this time (this xpath could be captured before popup shows).
I'm not sure the reason of ScreenshotException. But when set serenity.take.screenshot property is Disabled then everything is OK without Screenshot

@wakaleo
Copy link
Member

wakaleo commented Mar 26, 2022

Disable the screenshots or wait for version 3.2.2. Or figure out why Selenium/Appium is reporting an error.

An application's popup will display right after clicking the Button. Button is hidden and cannot capture xpath of button element this time (this xpath could be captured before popup shows). I'm not sure the reason of ScreenshotException. But when set serenity.take.screenshot property is Disabled then everything is OK without Screenshot

It might be an Appium driver bug then?

@ricardorlg
Copy link
Contributor

this one was hard, I was also facing the same problem, the error happens because since Serenity supports in the screenplay the method protected PageObject currentPageVisibleTo(Actor actor), the implementation is adding drivers that are already added in the driversMap, when a new test starts It tries to take a screenshot using the unclosed driver because is assuming driver is still there, the fix was to change how we handle the logic to get a driver given its name and avoid having duplicated drivers in driversMap.

@wakaleo let me know what u think, PR is coming

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

Successfully merging a pull request may close this issue.

3 participants