Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning a dynamic CSS selector to a static one

I have a dynamic CSS selector which turns out to be the only selector I could use in my robot framework test. I there any way to use this selector maybe using regex?

Here is my selector :

#weekend11063281 > a:nth-child(1)

Any solution to get rid of the dynamic id part after #weekend will be welcome!

Thanks

like image 519
Ziwdigforbugs Avatar asked Oct 31 '25 01:10

Ziwdigforbugs


1 Answers

Below code should solve your problem

//HTML
<div id="weekend11063281">
    <div>one</div>
    <div>two</div>   
</div>

//CSS

[id^='weekend'] > div:nth-child(1) {
    color: red;   
}
like image 143
Prabhat Singh Avatar answered Nov 02 '25 23:11

Prabhat Singh