Background
I encountered this error when I'm trying to click a button. However, the webpage would show that I am unable to press this submit button, then it will give me this error and stop running the programme. Does anyone know how to fix this error. I am currently using a CSS Selector to find the button. Does it make a difference if i use another method such as the XPATH method instead? Also, I have 100% verified that I have keyed in the correct element, while incorporating a WebDriverWait(EC.element_to_be_clickable(slot_submit_button), 4)
. I only study python and selenium so i do not have much knowledge about JavaScript, so please explain to me in simple terms so that i can understand this issue.
Your help would be really appreciated!!
Traceback (most recent call last):
File "C:\Users\Jonathan\PycharmProjects\BBDCBOT\BBDC1.py", line 88, in <module>
slot_submit_button.click()
File "C:\Users\Jonathan\venvs\automation\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Jonathan\venvs\automation\lib\site-packages\selenium\webdriver\remote\webelement.py", line 693, in _execute
return self._parent.execute(command, params)
File "C:\Users\Jonathan\venvs\automation\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
self.error_handler.check_response(response)
File "C:\Users\Jonathan\venvs\automation\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input type="button" name="" value="Submit" class="btn" onclick="postBooking(this.form, 'b-TPDSBookingConfirm.asp?limit=TPDS', '', 'Please select a slot to
book.')" onm ouseover="blueBtnOver(this)" onm ouseout="blueBtnOut(this)"> is not clickable at point (118, 330). Other element would receive the click: <td class="bluetxt">...</td>
(Session info: chrome=96.0.4664.45)
Stacktrace:
Backtrace:
Ordinal0 [0x00743AB3 2505395]
Ordinal0 [0x006DAE41 2076225]
Ordinal0 [0x005E2498 1057944]
Ordinal0 [0x00612C09 1256457]
Ordinal0 [0x00610F48 1249096]
Ordinal0 [0x0060ED0D 1240333]
Ordinal0 [0x0060DB68 1235816]
Ordinal0 [0x00603857 1194071]
Ordinal0 [0x006259F3 1333747]
Ordinal0 [0x00603676 1193590]
Ordinal0 [0x00625ADA 1333978]
Ordinal0 [0x00635168 1397096]
Ordinal0 [0x006258BB 1333435]
Ordinal0 [0x006023E4 1188836]
Ordinal0 [0x0060323F 1192511]
GetHandleVerifier [0x008CCB36 1554566]
GetHandleVerifier [0x00974A0C 2242396]
GetHandleVerifier [0x007D0E0B 523099]
GetHandleVerifier [0x007CFEB0 519168]
Ordinal0 [0x006E02FD 2097917]
Ordinal0 [0x006E4388 2114440]
Ordinal0 [0x006E44C2 2114754]
Ordinal0 [0x006EE041 2154561]
BaseThreadInitThunk [0x76A7FA29 25]
RtlGetAppContainerNamedObjectPath [0x77097A9E 286]
RtlGetAppContainerNamedObjectPath [0x77097A6E 238]
CodePudding user response:
This error means that element is present in the DOM but it is overlapped by some other element.
In your case,
<input type="button" name="" value="Submit" class="btn" onclick="postBooking(this.form, 'b-TPDSBookingConfirm.asp?limit=TPDS', '', 'Please select a slot to
book.')" onm ouseover="blueBtnOver(this)" onm ouseout="blueBtnOut(this)">
is overlapped by
<td class="bluetxt">...</td>
CodePudding user response:
Resolution by using javascript :-
button = find_element(By.XPATH, '<Valid Xpath>')
driver.execute_script("arguments[0].click();", button)