Skip to content

Instantly share code, notes, and snippets.

@friendlyfreedom
Created June 22, 2020 13:10
Show Gist options
  • Select an option

  • Save friendlyfreedom/05ded4a65a29fafbb87f07d0bfcf6e08 to your computer and use it in GitHub Desktop.

Select an option

Save friendlyfreedom/05ded4a65a29fafbb87f07d0bfcf6e08 to your computer and use it in GitHub Desktop.
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