Last active
August 7, 2021 08:55
-
-
Save leeuwe/3334a0eb6fac600deb9a200aa17982b2 to your computer and use it in GitHub Desktop.
This git lets you grab the Computed style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Settings *** | |
Library SeleniumLibrary | |
*** Keywords *** | |
Check CSS from element | |
[Documentation] This keyword only works with xpath and is based on [https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle|getComputedStyle] | |
... You can use this keyword as follows | |
... | Check CSS from Element | //path/to/element | style | Expected Value | | |
... | Check CSS from Element | //h2/div | font-size | 24px | | |
[Arguments] ${xpath} ${CheckStyle} ${ExpectedComputedStyle} | |
${ComputedStyle} Execute Javascript return document.defaultView.getComputedStyle(document.evaluate("${xpath}", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue,null)['${CheckStyle}'] | |
Should Be Equal ${ComputedStyle} ${ExpectedComputedStyle} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment