Git Product home page Git Product logo

hw_seckill's Introduction

Hi there 👋

Focus Repo

hw_seckill's People

Contributors

ancoka avatar harrywang29 avatar youridol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hw_seckill's Issues

开始抢购自动点击时报错:stale element not found

2023-09-22 10:07:59.863120 距离抢购开始还剩:00 天 00 时 00 分 01 秒
Traceback (most recent call last):
File "/home/eric/hw_seckill/main.py", line 14, in
main()
File "/home/eric/hw_seckill/main.py", line 9, in main
huawei.start_process()
File "/home/eric/hw_seckill/huawei.py", line 39, in start_process
self.__start_buying()
File "/home/eric/hw_seckill/huawei.py", line 112, in __start_buying
button_element.click()
File "/home/eric/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
self._execute(Command.CLICK_ELEMENT)
File "/home/eric/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 394, in _execute
return self._parent.execute(command, params)
File "/home/eric/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "/home/eric/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: stale element not found
(Session info: chrome=117.0.5938.88); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#stale-element-reference-exception
Stacktrace:
#0 0x55e316f156b3
#1 0x55e316beb1e7
#2 0x55e316bf013e
#3 0x55e316bf19c0
#4 0x55e316bf1a7c
#5 0x55e316c34454
#6 0x55e316c33489
#7 0x55e316c284f9
#8 0x55e316c540c2
#9 0x55e316c27f16
#10 0x55e316c5428e
#11 0x55e316c6d322
#12 0x55e316c53e93
#13 0x55e316c26934
#14 0x55e316c2771e
#15 0x55e316edacb8
#16 0x55e316edebf0
#17 0x55e316ee919c
#18 0x55e316edf808
#19 0x55e316eac27f
#20 0x55e316f03e88
#21 0x55e316f04059
#22 0x55e316f14843
#23 0x7f20e5e94b43

最新的代码最后阶段一样的报错,使用的edge浏览器

2023-10-11 10:07:50.673366 距离抢购开始还剩:00 天 00 时 00 分 10 秒
2023-10-11 10:07:51.716925 距离抢购开始还剩:00 天 00 时 00 分 09 秒
2023-10-11 10:07:51.720912 距离抢购开始还剩8秒
2023-10-11 10:07:56.772348 距离抢购开始还剩3秒
2023-10-11 10:07:59.787371 距离抢购开始还剩0秒
2023-10-11 10:07:59.831748 距离抢购开始还剩0秒
2023-10-11 10:07:59.877618 距离抢购开始还剩0秒
Traceback (most recent call last):
File "C:\Users\Foxman\Desktop\hw_seckill-master\main.py", line 25, in
main()
File "C:\Users\Foxman\Desktop\hw_seckill-master\main.py", line 10, in main
huawei.start_process()
File "C:\Users\Foxman\Desktop\hw_seckill-master\huawei.py", line 52, in start_process
self.__start_buying()
File "C:\Users\Foxman\Desktop\hw_seckill-master\huawei.py", line 195, in __start_buying
button_element.click()
File "D:\pycharm\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\webelement.py", line 93, in click
self._execute(Command.CLICK_ELEMENT)
File "D:\pycharm\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\webelement.py", line 394, in _execute
return self._parent.execute(command, params)
File "D:\pycharm\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "D:\pycharm\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (999, 681). Other element would receive the click:

...

(Session info: MicrosoftEdge=117.0.2045.60)
Stacktrace:
GetHandleVerifier [0x00007FF65E4999F2+63682]
Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF65E421942+267762]
(No symbol) [0x00007FF65E1DAC0E]
(No symbol) [0x00007FF65E232F3A]
(No symbol) [0x00007FF65E230A0C]
(No symbol) [0x00007FF65E22E0F6]
(No symbol) [0x00007FF65E22CD6A]
(No symbol) [0x00007FF65E21F1DC]
(No symbol) [0x00007FF65E24C84A]
(No symbol) [0x00007FF65E21EC51]
(No symbol) [0x00007FF65E21EAFD]
(No symbol) [0x00007FF65E24CB70]
(No symbol) [0x00007FF65E21EC51]
(No symbol) [0x00007FF65E266A81]
(No symbol) [0x00007FF65E24C623]
(No symbol) [0x00007FF65E21DA7A]
(No symbol) [0x00007FF65E21CD6B]
(No symbol) [0x00007FF65E21E204]
Microsoft::Applications::Events::EventProperty::to_string [0x00007FF65E665EF9+1233737]
(No symbol) [0x00007FF65E29B274]
Microsoft::Applications::Events::EventProperty::~EventProperty [0x00007FF65E3632AA+33498]
Microsoft::Applications::Events::EventProperty::~EventProperty [0x00007FF65E35BDE9+3609]
Microsoft::Applications::Events::EventProperty::to_string [0x00007FF65E664C94+1229028]
Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF65E42BAE8+309144]
Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF65E4267C4+287860]
Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF65E4268F2+288162]
Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF65E419FF1+236705]
BaseThreadInitThunk [0x00007FF89F177344+20]
RtlUserThreadStart [0x00007FF89FEE26B1+33]

IndexError: list index out of range

2023-09-23 18:02:33.486463 距离抢购开始还剩:00 天 00 时 05 分 28 秒
2023-09-23 18:02:34.549085 距离抢购开始还剩:00 天 00 时 05 分 27 秒
2023-09-23 18:02:35.616211 距离抢购开始还剩:00 天 00 时 05 分 26 秒
2023-09-23 18:02:37.916294 开始选择手机规格
2023-09-23 18:02:38.595376 选择手机规格完成,颜色:白沙银 版本:12GB+512GB
Traceback (most recent call last):
File "C:\Users\mmm\Desktop\hw_seckill\main.py", line 14, in
main()
File "C:\Users\mmm\Desktop\hw_seckill\main.py", line 9, in main
huawei.start_process()
File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 38, in start_process
self.__countdown()
File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 98, in __countdown
print("{0} 距离抢购开始还剩:{1}".format(datetime.now(), self.__format_countdown_time(countdown_times)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 150, in __format_countdown_time
countdown_all_times.append(countdown_time_units[index])
~~~~~~~~~~~~~~~~~~~~^^^^^^^
IndexError: list index out of range

运行中突然报上面的错,然后就结束了,这个什么原因啊

chrome版本比较低,【版本 92.0.4515.131(正式版本) (64 位)】怎么办?

执行main时报错
Traceback (most recent call last):
File "D:\study\hw_seckill\main.py", line 24, in
main()
File "D:\study\hw_seckill\main.py", line 8, in main
huawei = HuaWei("config.ini")
File "D:\study\hw_seckill\huawei.py", line 35, in init
self.__browser_setting()
File "D:\study\hw_seckill\huawei.py", line 149, in __browser_setting
browser = webdriver.Chrome(service=Service(ChromeDriverManager(driver_version="92.0.4515.131").install()), options=options)
File "C:\Python310\lib\site-packages\webdriver_manager\chrome.py", line 40, in install
driver_path = self._get_driver_binary_path(self.driver)
File "C:\Python310\lib\site-packages\webdriver_manager\core\manager.py", line 40, in _get_driver_binary_path
file = self._download_manager.download_file(driver.get_driver_download_url(os_type))
File "C:\Python310\lib\site-packages\webdriver_manager\core\download_manager.py", line 29, in download_file
response = self._http_client.get(url)
File "C:\Python310\lib\site-packages\webdriver_manager\core\http.py", line 36, in get
self.validate_response(resp)
File "C:\Python310\lib\site-packages\webdriver_manager\core\http.py", line 15, in validate_response
raise ValueError(f"There is no such driver by url {resp.url}")
ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/92.0.4515.131/chromedriver_win32.zip

这个问题怎么解决

运行显示Google Chrome无法对其数据目录/Users/用户名/Library/ApplicationSupport/Google/Chrome/Default执行读写操作

刷新网页

__waiting_count这个函数里没有刷新网页

远程连接关闭啥意思

2023-10-07 09:48:35.269954 开始解析配置文件
2023-10-07 09:48:35.270951 结束解析配置文件
2023-10-07 09:48:35.281922 开始设置浏览器参数
Traceback (most recent call last):
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
raise new_e
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 783, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\ssl
.py", line 469, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\ssl
.py", line 513, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1046, in _create
self.do_handshake()
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1317, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen(
^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\retry.py", line 470, in increment
raise reraise(type(error), error, _stacktrace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\util.py", line 38, in reraise
raise value.with_traceback(tb)
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
raise new_e
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 783, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\ssl
.py", line 469, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\ssl
.py", line 513, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1046, in _create
self.do_handshake()
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1317, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\core\http.py", line 32, in get
resp = requests.get(
^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 501, in send raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\hw_seckill-master\main.py", line 24, in
main()
File "E:\hw_seckill-master\main.py", line 8, in main
huawei = HuaWei("config.ini")
^^^^^^^^^^^^^^^^^^^^
File "E:\hw_seckill-master\huawei.py", line 31, in init
self.__browser_setting()
File "E:\hw_seckill-master\huawei.py", line 128, in __browser_setting
browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\chrome.py", line 40, in install
driver_path = self._get_driver_binary_path(self.driver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\core\manager.py", line 35, in _get_driver_binary_path
binary_path = self._cache_manager.find_driver(driver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\core\driver_cache.py", line 105, in find_driver
driver_version = self.get_cache_key_driver_version(driver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\core\driver_cache.py", line 151, in get_cache_key_driver_version
return driver.get_driver_version_to_download()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\core\driver.py", line 48, in get_driver_version_to_download
return self.get_latest_release_version()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\drivers\chrome.py", line 64, in get_latest_release_version
resp = self._http_client.get(url=latest_release_url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zjdn\AppData\Local\Programs\Python\Python312\Lib\site-packages\webdriver_manager\core\http.py", line 35, in get
raise exceptions.ConnectionError(f"Could not reach host. Are you offline?")
requests.exceptions.ConnectionError: Could not reach host. Are you offline?

定位登录按钮失败!

2023-10-07 19:17:50.420860 开始解析配置文件
2023-10-07 19:17:50.438796 结束解析配置文件
<configparser.ConfigParser object at 0x00000225746519D0>
2023-10-07 19:17:50.478871 开始设置浏览器参数
2023-10-07 19:17:55.464968 设置浏览器参数完成
2023-10-07 19:17:55.624871 开启抢购华为手机 Mate60Pro
2023-10-07 19:17:55.668729 开始进入华为官网
2023-10-07 19:18:02.705986 已进入华为官网
2023-10-07 19:18:02.735779 开始登陆华为账号
2023-10-07 19:18:02.754415 点击登录按钮
Traceback (most recent call last):
File "D:\FttrAutoTest\hw_seckill-master\main.py", line 24, in
main()
File "D:\FttrAutoTest\hw_seckill-master\main.py", line 9, in main
huawei.start_process()
File "D:\FttrAutoTest\hw_seckill-master\huawei.py", line 37, in start_process
self.__login()
File "D:\FttrAutoTest\hw_seckill-master\huawei.py", line 114, in __login
self.__goto_login_page()
File "D:\FttrAutoTest\hw_seckill-master\huawei.py", line 217, in __goto_login_page
login = WebDriverWait(self.browser, self.defaultTimeout).until(
File "C:\Users\RockHome\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\support\wait.py", line 92, in until
time.sleep(self._pol

后来发现是定位不到主页面的“请登录”按钮,使用LINK_TEXT也无法定位,XPATH也试了。有大佬成功过没?

运行错误:提示No section: 'chrome'

一、检查chromedriver与chrome的版本一致:
图片
二、检查config里面 userDataDir的配置如下:
userDataDir = /Users/sivan/Library/Application Support/Google/Chrome/Default

但运行main.py后提示如下报错:
图片

是chromedriver的问题吗?

还是这版不支持Mac电脑了?

这是报错信息

Traceback (most recent call last):
File "/Users/vopoe/Desktop/hw_seckill-master/main.py", line 25, in
main()
File "/Users/vopoe/Desktop/hw_seckill-master/main.py", line 9, in main
huawei = HuaWei("config.ini")
File "/Users/vopoe/Desktop/hw_seckill-master/huawei.py", line 35, in init
self.__browser_setting()
File "/Users/vopoe/Desktop/hw_seckill-master/huawei.py", line 167, in __browser_setting
self.__chrome_setting()
File "/Users/vopoe/Desktop/hw_seckill-master/huawei.py", line 220, in __chrome_setting
self.browser = webdriver.Chrome(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in init
super().init(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 51, in init
self.service.path = DriverFinder.get_path(self.service, options)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/common/driver_finder.py", line 44, in get_path
raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")
selenium.common.exceptions.NoSuchDriverException: Message: Unable to locate or obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

这是我的config

[product]
name=Mate60
id=10086970184614
color=雅丹黑
version=12GB+256GB
payment=全款购买
;默认套装为空,若套装为空时则抢购单品,否则,则抢购配置的套装
;sets=12GB+512GB 青山黛,木星棕 深棕色真皮表带,雅川青 无线充版
sets=

; 浏览器配置
[browser]
type=chrome
; 浏览器类型,当前仅支持:chrome、firefox
driverPath=/usr/local/bin
; driver为对应浏览器驱动存放的绝对路径,如果设置,则加载该路径的驱动,未设置需要将驱动加到环境变量
; driverPath=/path/to/chromedriver
; 是否开启无界面模式,默认为否,无界面模式需要设置userAgent
headless=no
; 请设置对应浏览器对应的userAgent
; userAgent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
; 谷歌浏览器浏览器特有配置
[chrome]
userDataDir=/Users/vopoe/Library/Application Support/Google/Chrome/Default

no such element: Unable to locate element: {"method":"css selector","selector":".css-901oao"}

大佬看看
2023-09-21 17:28:55.594017 开始输入账号及密码
2023-09-21 17:29:00.900129 发起登陆请求
Traceback (most recent call last):
File "C:\mate60\hw_seckill\main.py", line 14, in
main()
File "C:\mate60\hw_seckill\main.py", line 9, in main
huawei.start_process()
File "C:\mate60\hw_seckill\huawei.py", line 31, in start_process
self.__login()
File "C:\mate60\hw_seckill\huawei.py", line 98, in __login
text = self.browser.find_element(By.CLASS_NAME, "css-901oao").text
File "C:\Users\luzhu\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 738, in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
File "C:\Users\luzhu\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "C:\Users\luzhu\AppData\Local\Programs\Python\Python39\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":"css selector","selector":".css-901oao"}
(Session info: chrome=117.0.5938.89); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
GetHandleVerifier [0x0042CE93+45171]
(No symbol) [0x003B90E1]
(No symbol) [0x002ABE1D]
(No symbol) [0x002DED40]
(No symbol) [0x002DF20B]
(No symbol) [0x0030F692]
(No symbol) [0x002FB094]
(No symbol) [0x0030DCFA]
(No symbol) [0x002FAE46]
(No symbol) [0x002D675E]
(No symbol) [0x002D78FD]
GetHandleVerifier [0x006E5499+2897529]
GetHandleVerifier [0x0072DC4B+3194411]
GetHandleVerifier [0x00727A21+3169281]
GetHandleVerifier [0x004B6110+606960]
(No symbol) [0x003C2E5C]
(No symbol) [0x003BEFE8]
(No symbol) [0x003BF10F]
(No symbol) [0x003B1807]
BaseThreadInitThunk [0x76C7FCC9+25]
RtlGetAppContainerNamedObjectPath [0x77CE7B1E+286]
RtlGetAppContainerNamedObjectPath [0x77CE7AEE+238]

您好请问这个报错要如果解决

我更新了适配浏览器的驱动后依旧报错
Traceback (most recent call last):
File "C:\Users\A\Desktop\hw_seckill-master\main.py", line 24, in
main()
File "C:\Users\A\Desktop\hw_seckill-master\main.py", line 8, in main
huawei = HuaWei("config.ini")
File "C:\Users\A\Desktop\hw_seckill-master\huawei.py", line 31, in init
self.__browser_setting()
File "C:\Users\A\Desktop\hw_seckill-master\huawei.py", line 128, in __browser_setting
browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
File "D:\anaconda3\hw_seckill-master\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in init
super().init(
File "D:\anaconda3\hw_seckill-master\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 56, in init
super().init(
File "D:\anaconda3\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 205, in init
self.start_session(capabilities)
File "D:\anaconda3\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 289, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
File "D:\anaconda3\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "D:\anaconda3\hw_seckill-master\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
GetHandleVerifier [0x007FCEB3+45171]

程式不能跑起来session not created: DevToolsActivePort file doesn't exist

请大佬指点:
DevTools listening on ws://127.0.0.1:51344/devtools/browser/1adcee07-f8a2-4730-a12a-1146e052a17d
Traceback (most recent call last):
File "D:\software\hw_seckill-master\hw_seckill-master\main.py", line 24, in
main()
File "D:\software\hw_seckill-master\hw_seckill-master\main.py", line 8, in main
huawei = HuaWei("config.ini")
File "D:\software\hw_seckill-master\hw_seckill-master\huawei.py", line 31, in init
self.__browser_setting()
File "D:\software\hw_seckill-master\hw_seckill-master\huawei.py", line 106, in __browser_setting
browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
File "D:\software\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in init
super().init(
File "D:\software\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 56, in init
super().init(
File "D:\software\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 205, in init
self.start_session(capabilities)
File "D:\software\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 289, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
File "D:\software\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "D:\software\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: DevToolsActivePort file doesn't exist

倒计时结束后还是有些问题

2023-10-07 18:08:00.224248 距离抢购开始还剩:00 天 00 时 00 分 01 秒
2023-10-07 18:08:00.254549 距离抢购开始还剩:00 天 00 时 00 分 01 秒
Traceback (most recent call last):
File "/Users/xxx/Documents/project/python/hw_seckill/./main.py", line 24, in
main()
File "/Users/xxx/Documents/project/python/hw_seckill/./main.py", line 9, in main
huawei.start_process()
File "/Users/xxx/Documents/project/python/hw_seckill/huawei.py", line 42, in start_process
self.__start_buying()
File "/Users/xxx/Documents/project/python/hw_seckill/huawei.py", line 150, in __start_buying
button_element.click()
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
self._execute(Command.CLICK_ELEMENT)
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/selenium/webdriver/remote/webelement.py", line 394, in _execute
return self._parent.execute(command, params)
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: stale element not found
(Session info: chrome=117.0.5938.149); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#stale-element-reference-exception

运行main.py报错

Last login: Sat Oct 7 19:03:24 on ttys004
[oh-my-zsh] Can't update: not a git repository.
yangxudong@yangxudongdeMacBook-Pro  ~  python3 /Users/yangxudong/Downloads/hw_seckill-master/main.py
Traceback (most recent call last):
File "/Users/yangxudong/Downloads/hw_seckill-master/main.py", line 4, in
from huawei import HuaWei
File "/Users/yangxudong/Downloads/hw_seckill-master/huawei.py", line 5, in
from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
✘ yangxudong@yangxudongdeMacBook-Pro  ~ 

这个报错是因为啥,我的ini已经配置了,并且驱动已经装了

无法正常运行

chrome版本:117.0.5938.89
python版本:3.11.5
感觉应该是config文件里没写对。
1、nickname具体是哪个名字啊?
2、颜色应该是南糯紫、白沙银、雅川青、雅丹黑这四种中的一种吧,默认的宣白是个什么鬼 ?
3、id应该就是url里的那串数字吧 ?
4、应该也可以抢mate60吧?

报错NoSectionError: No section: 'chrome'?

2023-10-06 22:04:34.769717 开始解析配置文件
2023-10-06 22:04:34.771520 结束解析配置文件
2023-10-06 22:04:34.782689 开始设置浏览器参数
Traceback (most recent call last):
File "D:\Documents\hw_seckill-master\main.py", line 24, in
main()
File "D:\Documents\hw_seckill-master\main.py", line 8, in main
huawei = HuaWei("config.ini")
^^^^^^^^^^^^^^^^^^^^
File "D:\Documents\hw_seckill-master\huawei.py", line 31, in init
self.__browser_setting()
File "D:\Documents\hw_seckill-master\huawei.py", line 120, in __browser_setting
options.add_argument(r"--user-data-dir={}".format(self.__config_get("chrome", "userDataDir")))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Documents\hw_seckill-master\huawei.py", line 181, in __config_get
return self.configparser.get(group_name, item_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\Python\Lib\configparser.py", line 759, in get
d = self._unify_values(section, vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\Python\Lib\configparser.py", line 1130, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'chrome'

报错selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable (Session info: chrome=117.0.5938.149)

2023-10-06 22:17:39.152541 开始解析配置文件
2023-10-06 22:17:39.153536 结束解析配置文件
2023-10-06 22:17:39.164546 开始设置浏览器参数
2023-10-06 22:17:47.746670 设置浏览器参数完成
2023-10-06 22:17:47.748178 开启抢购华为手机 Mate60Pro
2023-10-06 22:17:47.749179 开始进入华为官网
2023-10-06 22:17:48.389686 已进入华为官网
2023-10-06 22:17:48.389686 开始登陆华为账号
2023-10-06 22:17:48.389686 点击登录按钮
2023-10-06 22:17:49.443988 已跳转登录页面
2023-10-06 22:17:49.444989 开始输入账号及密码
2023-10-06 22:17:51.862152 已输入账号及密码
2023-10-06 22:17:51.891490 发起登陆请求
2023-10-06 22:18:11.916087 账号登陆成功
2023-10-06 22:18:11.939108 当前登陆账号为:191****2839
2023-10-06 22:18:11.939108 结束登陆华为账号
2023-10-06 22:18:11.939108 开始进入华为 Mate60Pro 产品详情页
2023-10-06 22:18:14.962165 已进入华为 Mate60Pro 产品详情页
2023-10-06 22:18:14.962674 开始选择手机套装规格
Traceback (most recent call last):
File "D:\Python\project\hw_seckill-master\main.py", line 24, in
main()
File "D:\Python\project\hw_seckill-master\main.py", line 9, in main
huawei.start_process()
File "D:\Python\project\hw_seckill-master\huawei.py", line 39, in start_process
self.__choose_product()
File "D:\Python\project\hw_seckill-master\huawei.py", line 66, in __choose_product
self.__choose_product_sets(sets)
File "D:\Python\project\hw_seckill-master\huawei.py", line 76, in __choose_product_sets
).click()
^^^^^^^
File "D:\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webelement.py", line 93, in click
self._execute(Command.CLICK_ELEMENT)
File "D:\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webelement.py", line 394, in _execute
return self._parent.execute(command, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "D:\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=117.0.5938.149)
Stacktrace:
GetHandleVerifier [0x00F3CFE3+45267]
(No symbol) [0x00EC9741]
(No symbol) [0x00DBBCE0]
(No symbol) [0x00DEFF28]
(No symbol) [0x00DE855A]
(No symbol) [0x00E0B03C]
(No symbol) [0x00DE7F96]
(No symbol) [0x00E0B2B4]
(No symbol) [0x00E1DDDA]
(No symbol) [0x00E0AE36]
(No symbol) [0x00DE674E]
(No symbol) [0x00DE78ED]
GetHandleVerifier [0x011F5659+2897737]
GetHandleVerifier [0x0123E78B+3197051]
GetHandleVerifier [0x01238571+3171937]
GetHandleVerifier [0x00FC5E40+606000]
(No symbol) [0x00ED338C]
(No symbol) [0x00ECF508]
(No symbol) [0x00ECF62F]
(No symbol) [0x00EC1D27]
BaseThreadInitThunk [0x76C6FCC9+25]
RtlGetAppContainerNamedObjectPath [0x77E77B1E+286]
RtlGetAppContainerNamedObjectPath [0x77E77AEE+238]

image

ERROR:ssl_client_socket_impl.cc

2023-09-30 10:23:13.486255 已进入华为 HUAWEI Mate 60 RS 非凡大师 16GB+1TB 瑞红 ULTIMATE DESIGN 产品详情页
2023-09-30 10:23:13.486255 开始选择手机规格
2023-09-30 10:23:13.821485 选择手机规格完成,颜色:瑞红 版本:16GB+1TB
[9188:7388:0930/102314.287:ERROR:ssl_client_socket_impl.cc(968)] handshake failed; returned -1, SSL error code 1, net_error -101

你好我运行怎么出差 什么原因

Traceback (most recent call last):
File "C:\Users\xiaohai\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 789, in get
value = d[option]
File "C:\Users\xiaohai\AppData\Local\Programs\Python\Python39\lib\collections_init_.py", line 941, in getitem
return self.missing(key) # support subclasses that define missing
File "C:\Users\xiaohai\AppData\Local\Programs\Python\Python39\lib\collections_init_.py", line 933, in missing
raise KeyError(key)
KeyError: 'sets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\xiaohai\Desktop\hw_seckill-master\main.py", line 24, in
main()
File "C:\Users\xiaohai\Desktop\hw_seckill-master\main.py", line 9, in main
huawei.start_process()
File "C:\Users\xiaohai\Desktop\hw_seckill-master\huawei.py", line 39, in start_process
self.__choose_product()
File "C:\Users\xiaohai\Desktop\hw_seckill-master\huawei.py", line 64, in __choose_product
sets = self.__config_get("product", "sets")
File "C:\Users\xiaohai\Desktop\hw_seckill-master\huawei.py", line 181, in __config_get
return self.configparser.get(group_name, item_name)
File "C:\Users\xiaohai\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 792, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'sets' in section: 'product'****

日志显示异常,为灰色

**$ python main.py
2023-09-22 19:22:20.287938 ▒▒ʼ▒▒▒▒▒▒▒▒▒ļ▒
2023-09-22 19:22:20.288941 ▒▒▒▒▒▒▒▒▒▒▒▒▒ļ▒
2023-09-22 19:22:20.300060 ▒▒ʼ▒▒▒▒▒▒▒▒▒▒▒▒▒
2023-09-22 19:22:47.925994 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
2023-09-22 19:22:47.989994 ▒▒▒▒▒▒▒▒▒▒Ϊ Mate60 ▒ֻ▒
2023-09-22 19:22:47.989994 ▒▒ʼ▒▒▒뻪Ϊ▒▒▒▒
2023-09-22 19:22:48.256994 ▒ѽ▒▒뻪Ϊ▒▒▒▒
2023-09-22 19:22:48.256994 ▒▒ʼ▒▒½▒▒Ϊ▒˺▒
2023-09-22 19:22:48.256994 ▒▒▒▒▒¼▒▒ť
Traceback (most recent call last):
**

日志显示如上,有大佬遇到过吗 ?这个是什么原因啊 ?怎么修改啊 ?

倒计时几秒刷新

非常感谢,昨天试了下,正常运行。在开抢的最后几秒,刷新频次速度过快,导致网页直接返回了一个错误。浏览器自动关掉了。

运行报错啥原因

2023-10-03 09:41:02.589829 开始解析配置文件
Traceback (most recent call last):
File "D:\hw_seckill-master\main.py", line 24, in
main()
File "D:\hw_seckill-master\main.py", line 8, in main
huawei = HuaWei("config.ini")
File "D:\hw_seckill-master\huawei.py", line 30, in init
self.__config_parse(config_file)
File "D:\hw_seckill-master\huawei.py", line 186, in __config_parse
configparser.read(config_file, "utf-8")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\con
figparser.py", line 697, in read
self._read(fp, filename)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\con
figparser.py", line 1082, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'config.ini', line: 1
'\ufeff[user]\n'

这是chromedriver出问题了吗?

还是这版不支持Mac电脑了?
Traceback (most recent call last):
File "/Users/vopoe/Desktop/hw_seckill-master/main.py", line 25, in
main()
File "/Users/vopoe/Desktop/hw_seckill-master/main.py", line 9, in main
huawei = HuaWei("config.ini")
File "/Users/vopoe/Desktop/hw_seckill-master/huawei.py", line 35, in init
self.__browser_setting()
File "/Users/vopoe/Desktop/hw_seckill-master/huawei.py", line 167, in __browser_setting
self.__chrome_setting()
File "/Users/vopoe/Desktop/hw_seckill-master/huawei.py", line 220, in __chrome_setting
self.browser = webdriver.Chrome(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in init
super().init(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 51, in init
self.service.path = DriverFinder.get_path(self.service, options)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/common/driver_finder.py", line 44, in get_path
raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")
selenium.common.exceptions.NoSuchDriverException: Message: Unable to locate or obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

在手机套装规格停顿后自动关闭

尝试了各种手机版本。各种抢购模式,全款,75天预购,90天预购,颜色,规格。都是在开始选择手机套装规格处停止。网站页面没有规格无变化处于默认状态。几秒后辅助窗口自动关闭。我是哪里搞错了吗?
还有就是RS版本每天只有10.08分一次抢购机会,但是并没有显示购买方式,只是一个倒计时。购买方式处如何填写确保有效性?
如果以上问题不存在,老板可否弄个抢购成功后来个提示音,或者自动发个微信啥的。这样可以不用守着电脑了,因为付款时间只有15分钟

登陆跳转失败,未找到登陆跳转链接

刚下载最新的代码,使用Chrome浏览器 headless=no
win7系统
chrome版本是109.0.5414.120(正式版本) (64 位)
这个是因为 我开代理服务器了吗 但是我关闭代理服务器 还是这个错误
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.