Writing a selector based on a background color question

Skip to first unread message


Oct 23, 2017, 12:14:06 PM10/23/17
to Spock Framework - User

I was hoping to ask for a little help. 

I've attached a sample of the html I'm looking at. 

I was hoping to write a selector in a spock test based around the background color. 

I'd like to select the line with the yellow background color(rgba(255, 255, 0, 0.3)) with the class = "highlight_outer" 

But the yellow background color can appear on any of the html lines. 

So far what I have is: 

def firstHighlight = $( "div.highlight_outer").first()

assert firstHighlight.css("background color") == "rgba(255, 255, 0, 0.3)" 

This works ok but of course only for when the yellow background color is on the first line of the set. 

Any ideas how I can write a selector to pick out the yellow background color line wherever it occurs in the set? 

Thanks so much... 

background color Capture.JPG
Reply all
Reply to author
0 new messages