Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Writing a selector based on a background color in the html in a Spock test question

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi... I have a question relating to the Spock framework and Groovy

I'm relatively new to html and Spock.

Here is some of the html I am looking at:




I'd like to write a selector to pick out the line with the yellow background color which I think has: rgba(255, 255, 0, 0.3)
The problem is this yellow line can appear anywhere in the set of background-color lines.

So far what I have is:


which works ok if the yellow line is on the first line of the set.

Any ideas on how I can rewrite the selector to pick out the yellow line no matter where
it is in the set of html lines?

Thanks so much... Rich
 
Sheriff
Posts: 67619
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Those look like jQuery statements. If so, then the substring attribute selector can be used to find a substring anywhere in an attribute. For example:
which will match any element whose style attribute contains the substring fred
 
Bear Bibeault
Sheriff
Posts: 67619
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More on jQuery attribute selectors here.
reply
    Bookmark Topic Watch Topic
  • New Topic