Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Feature Request: Screenshot fail gracefully when removeElements non-existing #57

Closed
Christopher-Hayes opened this issue Mar 11, 2020 · 2 comments

Comments

@Christopher-Hayes
Copy link

Is your feature request related to a problem? Please describe.
I have elements that only exist on certain pages and the library not finding one of the remove elements causes the screenshot to never be taken. For me, it isn't critical that every element in removeElements is removed. I just want the elements that do exist to be removed and non-existing ones to be ignored because some can be intermittent (ex: random sales popup).

Describe the solution you'd like
I would like the screenshot function (like saveFullPageScreen()) to first check if an element exists before attempting to remove it, or at least fail in a way that doesn't stop the screenshot from being taken.

Describe alternatives you've considered
My current solution is to create a removeElements array ahead of the saveFullPageScreen() by first checking isDisplayed() on each element before passing that to the saveFullPageScreen() options.

Additional context
It looks like xPath doesn't like elements that don't exist, causes the function to fail. For context in the error below .lp_promo_banner is the element by trying to hide that doesn't exist on all pages.
image
If it's useful, my (simplified) function call looks like:

browser.saveFullPageScreen(path, {
    removeElements: [
        $('.lp_promo_banner')
    ]
})
@Christopher-Hayes Christopher-Hayes changed the title Feature Request: Make Screenshot Fail Gracefully when removeElements contain non-existing elements Feature Request: Make Screenshot Fail Gracefully when removeElements non-existing Mar 11, 2020
@Christopher-Hayes Christopher-Hayes changed the title Feature Request: Make Screenshot Fail Gracefully when removeElements non-existing Feature Request: Screenshot fail gracefully when removeElements non-existing Mar 11, 2020
@wswebcreation wswebcreation self-assigned this Mar 11, 2020
@wswebcreation
Copy link
Owner

@Christopher-Hayes

Going to fix this with a console warning like this

image

Will be released soon

@wswebcreation
Copy link
Owner

@Christopher-Hayes

I've released version https://github.com/wswebcreation/wdio-image-comparison-service/releases/tag/v1.13.0. Can you please check it and if fixed close the issue?

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

No branches or pull requests

2 participants