Add "Get CSS Property Value" keyword to retrieve computed CSS values by b-vamsipunnam · Pull Request #1969 · robotframework/SeleniumLibrary
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 Valueinsrc/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.robotcovering: - 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 !