Search code examples
seleniumselenium-webdriverbrowserstack

Test the rendering of HTML and CSS


I need to test if the following HTML code and the CSS of that page results into a red and line-through price like:

enter image description here

<div class="listOldPrice">
  <span>
    <span class="wasPriceEuroDestination">&euro;&nbsp;</span>
    719.
    <b>-</b>
  </span>
</div>

Can I do that with Selenium? How?


Solution

  • This is the Ruby solution:

    price = @driver.find_element(:class, 'wasPriceEuroDestination')
    assert_equal(true, price.displayed?)
    assert_equal("rgba(255, 0, 0, 1)", price.css_value('color'))
    assert_equal("line-through", price.css_value('text-decoration'))