Book Your First Class - Tuesday at 6pm 📅

Now for the fun part - actually booking a class!  Figuring out how to use the selectors for this is also the hard part!

Your task:

Hints:



One more hint...

Right click to inspect various elements in the class table. Do you see a pattern in the naming of IDs? 


Say there are paragraph elements like this:

<p id="class-time-123">Tuesday</p>

<p id="something-456">Blah blah</p>

<p id="class-time-789">Thursday</p>

Here's how you might select the first and third paragraph elements that share the same naming convention with your selector:


find_element(By.CSS_SELECTOR, "p[id^='class-time-']")

This part is key:

"p[id^='class-time-']"



Ancestors: How to find a parent 🧑‍🧒‍🧒

We'll need to figure out if a class takes place on a Tuesday. But the day is not on the card itself - it's in the parent. So how do we access the parent if we've found the class cards? 

You can think of the HTML DOM like a family tree:

All of those wrappers are ancestors. This means we can use ancestor::div to walk upward to the parent and list every wrapping <div> on the way to the root of the page. This should help you locate the parents for the cards.


SOLUTION CODE