• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

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
  • 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: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More on jQuery attribute selectors here.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!