import json
import time
import openpyxl
import requests
from jsonpath import jsonpath
from selenium import webdriver
from selenium.webdriver.common.by import By
"""
"""
以下是报错
"""
D:\Users\XXXXX\AppData\Local\Programs\Python\Python311\python.exe H:\Users\天猫数据抓取\天猫数据抓取\数据抓取.py
请输入商品名称:铜螺母
Traceback (most recent call last):
File "H:\Users\天猫数据抓取\天猫数据抓取\数据抓取.py", line 106, in <module>
search_data(search_word)
File "H:\Users\天猫数据抓取\天猫数据抓取\数据抓取.py", line 49, in search_data
driver.find_element(By.XPATH, '//a[@class="sn-login"]').click()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Users\XXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 741, in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Users\XXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 347, in execute
self.error_handler.check_response(response)
File "D:\Users\XXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a[@class="sn-login"]"}
(Session info: chrome=123.0.6312.59); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
GetHandleVerifier [0x00007FF7693670C2+63090]
(No symbol) [0x00007FF7692D2D12]
(No symbol) [0x00007FF76916EC65]
(No symbol) [0x00007FF7691B499D]
(No symbol) [0x00007FF7691B4ADC]
(No symbol) [0x00007FF7691F5B37]
(No symbol) [0x00007FF7691D701F]
(No symbol) [0x00007FF7691F3412]
(No symbol) [0x00007FF7691D6D83]
(No symbol) [0x00007FF7691A83A8]
(No symbol) [0x00007FF7691A9441]
GetHandleVerifier [0x00007FF76976262D+4238301]
GetHandleVerifier [0x00007FF76979F78D+4488509]
GetHandleVerifier [0x00007FF769797A6F+4456479]
GetHandleVerifier [0x00007FF769440606+953270]
(No symbol) [0x00007FF7692DE5DF]
(No symbol) [0x00007FF7692D92B4]
(No symbol) [0x00007FF7692D93EB]
(No symbol) [0x00007FF7692C9C24]
BaseThreadInitThunk [0x00007FF9AD65257D+29]
RtlUserThreadStart [0x00007FF9AEEAAA58+40]
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a[@class="sn-login"]"}