I’m trying to automate posting listings on facebook marketplace with url:
https://www.facebook.com/marketplace/create/item
but I can’t click on or send keys to elements even when successfully found.
The page looks like this:
For example, lets say I want to click on the title input box, which was highlighted in the previous image.
My code:
title = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[text()='Title']")))
print(title.text)
title.click()
title.send_keys('text')
The element is successfully located and print(title.text) correctly prints “Title” but whenever I try to click the element I get the following error:
Traceback (most recent call last):
File "C:UsersUserPycharmProjectspythonProjecttest.py", line 411, in <module>
title.click()
File "C:UsersUserPycharmProjectspythonProject.venvLibsite-packagesseleniumwebdriverremotewebelement.py", line 94, in click
self._execute(Command.CLICK_ELEMENT)
File "C:UsersUserPycharmProjectspythonProject.venvLibsite-packagesseleniumwebdriverremotewebelement.py", line 395, in _execute
return self._parent.execute(command, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUserPycharmProjectspythonProject.venvLibsite-packagesseleniumwebdriverremotewebdriver.py", line 354, in execute
self.error_handler.check_response(response)
File "C:UsersUserPycharmProjectspythonProject.venvLibsite-packagesseleniumwebdriverremoteerrorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <span class="x1jchvi3 x1fcty0u x132q4wb x193iq5w x1al4vs7 x72wyj2 xmper1u x1lliihq x1923su1 x6ikm8r x10wlt62 x47corl x10l6tqk x16q8cke xlyipyv xoyzfg9 x1k90msu x11xpdln x1qfuztq xuxw1ft">...</span> is not clickable at point (184, 565). Other element would receive the click: <input dir="ltr" id=":r1b:" class="x1i10hfl xggy1nq x1s07b3s x1kdt53j x1a2a7pz xjbqb8w x1ejq31n xd10rxx x1sy0etr x17r0tee x9f619 xzsf02u x1uxerd5 x1fcty0u x132q4wb x1a8lsjc x1pi30zi x1swvt13 x9desvi xh8yej3 x15h3p50 x10emqs4" type="text" value="">
(Session info: chrome=126.0.6478.127)
I get a similar error when trying to send keys to the element. The title element html is:
<input dir="ltr" id=":r1b:" class="x1i10hfl xggy1nq x1s07b3s x1kdt53j x1a2a7pz xjbqb8w x1ejq31n xd10rxx x1sy0etr x17r0tee x9f619 xzsf02u x1uxerd5 x1fcty0u x132q4wb x1a8lsjc x1pi30zi x1swvt13 x9desvi xh8yej3 x15h3p50 x10emqs4" type="text" value="" xpath="1">
I believe the element is dynamic as the id sometimes changes but the xpath selector:
//*[text()='Title']
that I’m using works every time and I tend to locate elements by text as the other elements on the page seems to be dynamic as well.