0

I am trying to click an element on a website but can't find any way of identifying it.

The element is shown here (highlighted in blue):

enter image description here

For example, this does not work but for some reason does not raise an error:

wait.until(EC.element_to_be_clickable((By.ID, "ew--26811263891"))).click()

The element can be found on this page https://www.oddschecker.com/horse-racing/kempton/19:00/winner by first clicking on the box in the grid with header PaddyPower and row label Sharesa.

Andy
  • 509
  • 2
  • 7

1 Answers1

0

Since I can see on the design that it's a custom checkbox, I think the problem might be you should actually be clicking on the outermost element or, by looking at your screenshot, clicking on the label that you highlighted should work too.

lucaswxp
  • 2,031
  • 5
  • 23
  • 34
  • Thanks @lucaswxp I've tried all sorts but just can't get it to work. None of these have worked: `driver.find_element_by_xpath("//label[@for='ew--26811514266']")("//label[@for='ew--26811514266']") wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='_3yz7L6']//div[@class='_2S_LCT']"))).click() #wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='_3geHA9']//div[@class='_3yz7L6']"))).click() wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='_3yz7L6']"))).click()` – Andy Oct 20 '21 at 09:37
  • 1
    @Andy Try getting the coordinates (x,y) of the element, selenium has a method for that or you can hardcode the coordinates yourself looking at devtools just for testing. Then you can perform a click operation on that exact coordinate: check here how https://stackoverflow.com/a/51637548/786418 – lucaswxp Oct 20 '21 at 19:13