I am trying to click in call loop toggle with Selenium with the WebDriver on Python.
the html code:
this is the button:
I have tried few options:
JavaScript
x
3
1
button_element = driver.find_element_by_class_name("iPhoneCheckContainer")
2
button_element.click()
3
the filed message:
JavaScript
1
14
14
1
Traceback (most recent call last):
2
File "C:UserskostiPycharmProjectstest1main.py", line 50, in <module>
3
element = driver.find_element_by_xpath("//input[@id='on_off_on']").click()
4
File "C:UserskostiAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdriverremotewebelement.py", line 80, in click
5
self._execute(Command.CLICK_ELEMENT)
6
File "C:UserskostiAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdriverremotewebelement.py", line 633, in _execute
7
return self._parent.execute(command, params)
8
File "C:UserskostiAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdriverremotewebdriver.py", line 321, in execute
9
self.error_handler.check_response(response)
10
File "C:UserskostiAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdriverremoteerrorhandler.py", line 242, in check_response
11
raise exception_class(message, screen, stacktrace)
12
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>
13
(Session info: chrome=88.0.4324.150)
14
Advertisement
Answer
JavaScript
1
11
11
1
from selenium.webdriver.common.by import By
2
from selenium.webdriver.support.ui import WebDriverWait
3
from selenium.webdriver.support import expected_conditions as EC
4
5
elem=WebDriverWait(driver,5000).until(EC.visibility_of_element_located(
6
(By.XPATH, "//input[@id='on_off_on']")))
7
8
driver.execute_script("arguments[0].scrollIntoView();",elem)
9
10
element.click()
11
Try using webdriver wait