Selenium python how I preform a click on toggle button

Tags: , , , ,

I am trying to click in call loop toggle with Selenium with the WebDriver on Python.

the html code:

enter image description here

this is the button:

enter image description here

I have tried few options:

button_element = driver.find_element_by_class_name("iPhoneCheckContainer")

the filed message:

Traceback (most recent call last):
  File "", line 50, in <module>
    element = driver.find_element_by_xpath("//input[@id='on_off_on']").click()
  File "", line 80, in click
  File "", line 633, in _execute
    return self._parent.execute(command, params)
  File "", line 321, in execute
  File "", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input type="checkbox" id="on_off_on" value="1" name="AllowReset" checked=""> is not clickable at point (171, 261). Other element would receive the click: <div class="iPhoneCheckHandle" style="width: 30px; left: 30px;">...</div>
  (Session info: chrome=88.0.4324.150)


from import By
from import WebDriverWait
from import expected_conditions as EC

    (By.XPATH, "//input[@id='on_off_on']")))


Try using webdriver wait

Source: stackoverflow