1

I am trying to make a bot that automates booking a study room (Microsoft booking). When I try to select the radio button, it doesn't work. I tried using id and CSS_SELECTOR. I appreciate any help you can provide.

I want select room C, ID:service_2

room_c_select=driver.find_element(By.ID, "service_2")
room_c_select.click()

driver.find_element(By.CSS_SELECTOR,"input#service_2").click()

driver.find_element(By.CSS_SELECTOR,"[class='right serviceCard']input[type='radio'][id='service_2']")[0].click()

2 Answers2

0

You have to click on the small circle, i.e.

driver.find_elements(By.CSS_SELECTOR, 'span.image.icon-circleRegular')[1].click()
sound wave
  • 3,191
  • 3
  • 11
  • 29
0

Using find_elements() to locate any specific element isn't a part of the best practices as demonstrated by the other answer.

As per the html published as a comment, to click on the associated with the text Group Study Room C you can use the following locator strategy:

driver.find_element(By.XPATH, "//div[@class='name line-clamp' and text()='Group Study Room C']//ancestor::label[1]").click()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352