Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css selector for elements with style attribute

I have an element with the following styles

<ul class="textboxlist-bits" style="background-color: transparent;">

Now I want to select the element based on the style attribute.

The css selector ul [style="background-color: transparent;"] does not work there.

Kindly suggest an appropriate selector to identify such element.

like image 795
Rogers Jefrey L Avatar asked Sep 11 '25 23:09

Rogers Jefrey L


1 Answers

I think you only have to remove the first space:

ul[style="background-color: transparent;"]

Now it is searching all ul-tags which have this style; with the space between it tries to select all dom elements in(!) a ul-tag which have this sytle.

Here an example with the querySelector for javascript, it should work with selenium too.

like image 136
scessor Avatar answered Sep 13 '25 14:09

scessor