• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

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: 67759
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: 67759
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.
 
Do Re Mi Fa So La Tiny Ad
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic