[Tutor] FW: Python Selenium

stephen.m.smith at comcast.net stephen.m.smith at comcast.net
Sat Nov 24 16:41:16 EST 2018


I am working with a site that allows you to make reservations for different times of the day. The HTML (controlled by someone else) does not include specific names for each time – the HTML is very similar. With help from this group, I have figured out how to locate an element using an xpath with the time spelled out (this way the module can substitute a time based on user input). Here is the line of code (for 7:35):

 

               br.find_element_by_xpath("//div[contains(.,'7:35')]")

 

Here is where I need assistance: I need to access an element associated with that element to see if it is blank or occupied. I have included the HTML for two different time slots. The first (7:30) is not occupied as shown by the 4 class statements at the bottom with the ><.

 



 

The second, for 7:35 is partially occupied – the names are shown as is the slot count information.

 



 

I am trying to figure out a clever way to look down in the HTML once I have found the element to see if it is partially occupied or not. Any help with that would be appreciated.

 

 



More information about the Tutor mailing list