Traceback (most recent call last): File "d:\pythonbaijiahao\baijiahao.py", line 82, in mianrun sub_element.click() File "D:\python3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 81, in click self._execute(Command.CLICK_ELEMENT) File "D:\python3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 710, in _execute return self._parent.execute(command, params) File "D:\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 425, in execute self.error_handler.check_response(response) File "D:\python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a class="client_pages_content_v2_components_data2action_actions_videoManageGoods" href="/builder/rc/edit?edit_goods=1&type=videoV2&article_id=4818569555802859271&had_goods=1&video_type=ugc_video" target="_blank" rel="noopener noreferrer" data-urlkey="内容管理页-...-点击pv/uv">管理商品</a> is not clickable at point (930, 347). Other element would receive the click: <svg viewBox="64 64 896 896" focusable="false" data-icon="vertical-align-top" width="1em" height="1em" fill="currentColor" aria-hidden="true">...</svg> (Session info: MicrosoftEdge=113.0.1774.42) Stacktrace:
时间: 2023-06-26 17:05:10 浏览: 453
这是一个 Selenium 的异常信息,提示元素被遮挡而无法点击。具体来说,它告诉我们在点击某个元素时,该元素的某一部分被其他元素覆盖,导致无法点击。解决方法可以尝试以下几个方案:
- 等待元素可点击再进行点击操作,使用
WebDriverWait
等待元素可点击后再执行点击操作; - 尝试使用
ActionChains
类模拟鼠标操作,比如移动鼠标到元素上再进行点击; - 如果上述方法都无法解决问题,可以尝试使用 JavaScript 执行点击操作,通过
driver.execute_script("arguments[0].click();", element)
执行 JavaScript 代码模拟点击操作。
相关问题
Traceback (most recent call last): File "d:\pythonbaijiahao\baijiahao.py", line 63, in mianrun pagination_element.click()
这个错误可能是因为页面上没有找到 pagination_element
这个元素。你可以检查一下代码中 pagination_element
是否正确地定位到了页面上的元素,或者该元素是否存在。如果该元素不存在,你可以尝试使用 try...except
来处理这个异常,或者在程序中加入一些等待时间,等待该元素加载出来再进行操作。
Exception in thread Thread-1 (worker): Traceback (most recent call last): File "D:\python\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "D:\python\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "c:\Users\12732\Desktop\qp\test.py", line 31, in worker Worker Thread-3 (worker) modified num: 7 Exception in thread Thread-2 (worker)fcntl.flock(f, fcntl.LOCK_EX) AttributeError: : Traceback (most recent call last): module 'fcntl' has no attribute 'LOCK_EX' File "D:\python\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "D:\python\lib\threading.py", line 953, in run Exception in thread Thread-3 (worker): Traceback (most recent call last): File "D:\python\lib\threading.py", line 1016, in _bootstrap_inner Worker Thread-4 (worker) modified num: 6 self._target(*self._args, **self._kwargs) self.run() File "c:\Users\12732\Desktop\qp\test.py", line 31, in worker Exception in thread Thread-4 (worker) File "D:\python\lib\threading.py", line 953, in run : Traceback (most recent call last): File "D:\python\lib\threading.py", line 1016, in _bootstrap_inner Worker Thread-5 (worker) modified num: 5 fcntl.flock(f, fcntl.LOCK_EX) self._target(*self._args, **self._kwargs)AttributeError: module 'fcntl' has no attribute 'LOCK_EX' File "c:\Users\12732\Desktop\qp\test.py", line 31, in worker self.run() File "D:\python\lib\threading.py", line 953, in run fcntl.flock(f, fcntl.LOCK_EX) self._target(*self._args, **self._kwargs)AttributeError: module 'fcntl' has no attribute 'LOCK_EX' File "c:\Users\12732\Desktop\qp\test.py", line 31, in worker Exception in thread Thread-5 (worker): Traceback (most recent call last): File "D:\python\lib\threading.py", line 1016, in _bootstrap_inner fcntl.flock(f, fcntl.LOCK_EX) self.run() AttributeError: File "D:\python\lib\threading.py", line 953, in run module 'fcntl' has no attribute 'LOCK_EX' self._target(*self._args, **self._kwargs) File "c:\Users\12732\Desktop\qp\test.py", line 31, in worker fcntl.flock(f, fcntl.LOCK_EX) AttributeError: module 'fcntl' has no attribute 'LOCK_EX'
这个报错是因为在您的代码中使用了fcntl
模块来进行文件锁定,但是在您的环境中该模块没有LOCK_EX
属性。这可能是因为您的操作系统不支持fcntl
模块或者您的Python版本不兼容fcntl
模块。
您可以尝试使用其他方式来实现文件锁定,例如使用msvcrt
模块(仅适用于Windows系统)或者使用fcntl
模块的其他属性(例如LOCK_SH
、LOCK_NB
等)。
另外,请确保您的Python版本和操作系统环境与代码中使用的模块和属性兼容。
如果您需要更具体的帮助,请提供您使用的Python版本以及操作系统信息。