Skip to content

Add "Get CSS Property Value" keyword to retrieve computed CSS values#1969

Open
b-vamsipunnam wants to merge 1 commit intorobotframework:masterfrom
b-vamsipunnam:add-get-css-property-value-keyword
Open

Add "Get CSS Property Value" keyword to retrieve computed CSS values#1969
b-vamsipunnam wants to merge 1 commit intorobotframework:masterfrom
b-vamsipunnam:add-get-css-property-value-keyword

Conversation

@b-vamsipunnam
Copy link
Copy Markdown

Summary
Adds a new keyword Get CSS Property Value to SeleniumLibrary for retrieving computed CSS property values from web elements.

Motivation
SeleniumLibrary provides keywords for accessing DOM attributes (Get DOM Attribute) and element properties (Get Property), but does not offer a direct way to retrieve computed CSS values.

Implementation

  • Added Get CSS Property Value in src/SeleniumLibrary/keywords/element.py
  • Supports both locator strings and WebElement inputs
  • Returns browser-computed CSS values (e.g., rgba(...), px)

Tests

  • Added acceptance tests in atest/acceptance/keywords/elements.robot covering:
  • Multiple CSS properties (display, font-size, margin-top, text-align)
  • Computed values (background-color)
  • Missing element handling
  • WebElement usage

Added test fixture:

  • atest/resources/html/cssproperties.html

Updated unit test keyword count to 183 in:

  • utest/test/api/test_plugins.py

Files Changed:

  • src/SeleniumLibrary/keywords/element.py
  • atest/acceptance/keywords/elements.robot
  • atest/resources/html/cssproperties.html
  • utest/test/api/test_plugins.py

Related Issues
No existing issue found.

Request
If this contribution aligns with project standards, I would appreciate consideration for adding the acknowledge label.

Thank you !

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 this pull request may close these issues.

1 participant