ancoka / hw_seckill Goto Github PK
View Code? Open in Web Editor NEW华为Mate系列手机自动抢购脚本,支持Mate60、Mate60Pro、Mate60Pro+、Mate X5等机型;支持以上机型选择颜色、版本。
License: GNU General Public License v3.0
华为Mate系列手机自动抢购脚本,支持Mate60、Mate60Pro、Mate60Pro+、Mate X5等机型;支持以上机型选择颜色、版本。
License: GNU General Public License v3.0
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
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?
[18944:18044:0924/175610.989: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\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]
huawei.py", line 98, in __countdown
print("{0} 距离抢购开始还剩:{1}".format(datetime.now(), self.__format_countdown_time(countdown_times)))
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
运行中突然报上面的错,然后就结束了,这个什么原因啊
执行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
mac chrome版本号和ua
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
**$ 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):
**
日志显示如上,有大佬遇到过吗 ?这个是什么原因啊 ?怎么修改啊 ?
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'****
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'
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
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]
还是这版不支持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
还是这版不支持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
[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
尝试了各种手机版本。各种抢购模式,全款,75天预购,90天预购,颜色,规格。都是在开始选择手机套装规格处停止。网站页面没有规格无变化处于默认状态。几秒后辅助窗口自动关闭。我是哪里搞错了吗?
还有就是RS版本每天只有10.08分一次抢购机会,但是并没有显示购买方式,只是一个倒计时。购买方式处如何填写确保有效性?
如果以上问题不存在,老板可否弄个抢购成功后来个提示音,或者自动发个微信啥的。这样可以不用守着电脑了,因为付款时间只有15分钟
chrome版本:117.0.5938.89
python版本:3.11.5
感觉应该是config文件里没写对。
1、nickname具体是哪个名字啊?
2、颜色应该是南糯紫、白沙银、雅川青、雅丹黑这四种中的一种吧,默认的宣白是个什么鬼 ?
3、id应该就是url里的那串数字吧 ?
4、应该也可以抢mate60吧?
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
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'
__waiting_count 这个函数的 while 循环之间没有重新刷新页面啊,那按钮永远是不可点击的
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也试了。有大佬成功过没?
教程再详细些
请大佬指点:
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
__waiting_count这个函数里没有刷新网页
非常感谢,昨天试了下,正常运行。在开抢的最后几秒,刷新频次速度过快,导致网页直接返回了一个错误。浏览器自动关掉了。
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已经配置了,并且驱动已经装了
运行显示Google Chrome无法对其数据目录/Users/用户名/Library/ApplicationSupport/Google/Chrome/Default执行读写操作
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:
大佬看看
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]
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot create default profile directory
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.