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

Add computedCssValue (other name?) Condition #628

Closed
vinogradoff opened this Issue Oct 25, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@vinogradoff
Member

vinogradoff commented Oct 25, 2017

Selenium has the method getCssValue which can process the actual computed values of css-styles

getCssValue("color")
getCssValue("background-color")
getCssValue("font")
getCssValue("font-size")

etc.

We should add the condition, that uses this for Selenide Condition to enable easy coding for examples like

element.shouldHave(computedCssValue("color","#00FF00"));
element.shouldHave(computedCssValue("font-size","24"));

etc. with-in typical Selenide Workflow to automatically benefit from waiting, screenshoting, clear error messages etc.

@vinogradoff

This comment has been minimized.

Member

vinogradoff commented Oct 25, 2017

I think that name "cssValue" will be confusing for many users, who may think, conditions looks in DOM for some css attributes....
"Computed" - gives a hint, that it is the actual value which depends on many variables (included css files, css classes, custom style attrbutes etc.).

Perhaps you could think of even better name?

computedCssStyle perhaps?

@vinogradoff vinogradoff added the feature label Oct 25, 2017

@kkochetov

This comment has been minimized.

kkochetov commented Oct 30, 2017

something like that?

    public static Condition cssAttribute(final String attributeName, final String expectedValue) {
        return new Condition("cssAttribute") {
            @Override
            public boolean apply(WebElement element) {
                return expectedValue.equalsIgnoreCase(element.getCssValue(attributeName));
            }

            @Override
            public String actualValue(WebElement element) {
                return element.getCssValue(attributeName);
            }
        };
    }
@BorisOsipov

This comment has been minimized.

Member

BorisOsipov commented May 4, 2018

I think that name "cssValue" will be confusing for many users, who may think, conditions looks in DOM for some css attributes. "Computed" - gives a hint, that...

I think it's ok to call it "cssValue" as is in Selenium. It will make reference to the original Selenium method call.

@vinogradoff

This comment has been minimized.

Member

vinogradoff commented May 4, 2018

@rosolko rosolko referenced this issue May 4, 2018

Merged

Add cssValue condition. #727

3 of 3 tasks complete

@asolntsev asolntsev added this to the 4.11.3 milestone May 8, 2018

@asolntsev asolntsev assigned asolntsev and rosolko and unassigned asolntsev May 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment