Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium capybara check background color of a div within another div

I have a div with an id which contains a div with no id but it has a class. No the issue is,I want to check the background color of the second div. Your help is welcome.

<div id = "wrapper">
<div class="container iframe-container">

        <style>
           body { background-color: #000111; } .form-horizontal .control-label { font-style: normal; } ...
        </style>

basically I want to check if the background is #000111

like image 696
Jaak Vilo Avatar asked Dec 24 '22 04:12

Jaak Vilo


1 Answers

Finally found the answer:

within_frame('wrapper') do
   color = find('body').native.css_value('background-color')
   expect(color).to eq('rgba(0, 1, 17, 1)')
end
like image 108
Jaak Vilo Avatar answered Dec 30 '22 06:12

Jaak Vilo