from selenium import webdriver # 设置Chrome浏览器驱动程序的路径 driver_path = "C:\Program Files\Google\Chrome\Application/chromedriver" # 创建Chrome浏览器对象 driver = webdriver.Chrome(driver_path) # 打开百度网页 driver.get("https://www.baidu.com") # 找到搜索框元素,并输入关键字 search_box = driver.find_element_by_css_selector("#kw") search_box.send_keys("RPA") # 找到搜索按钮元素,并点击 search_button = driver.find_element_by_css_selector("#su") search_button.click() # 等待搜索结果加载完成 driver.implicitly_wait(5) # 获取搜索结果列表 search_results = driver.find_elements_by_css_selector(".result") # 打印搜索结果标题和链接 for result in search_results: title = result.find_element_by_css_selector("h3").text url = result.find_element_by_css_selector("a").get_attribute("href") print(f"Title: {title}") print(f"URL: {url}") print("") # 关闭浏览器 driver.quit() 将读取的数据保存成pdf

时间: 2024-04-20 10:23:17 浏览: 174
要将搜索结果保存为PDF文件,你可以使用第三方库来实现,例如使用`pdfkit`库。 首先,你需要安装`pdfkit`库。在命令行中运行以下命令: ``` pip install pdfkit ``` 然后,你需要下载并安装wkhtmltopdf工具,它是将HTML转换为PDF的工具。下载地址:https://wkhtmltopdf.org/downloads.html 安装完成后,你可以按照以下方式修改你的代码来保存搜索结果为PDF文件: ```python import pdfkit from selenium import webdriver # 设置Chrome浏览器驱动程序的路径 driver_path = "C:\Program Files\Google\Chrome\Application/chromedriver" # 创建Chrome浏览器对象 driver = webdriver.Chrome(driver_path) # 打开百度网页 driver.get("https://www.baidu.com") # 找到搜索框元素,并输入关键字 search_box = driver.find_element_by_css_selector("#kw") search_box.send_keys("RPA") # 找到搜索按钮元素,并点击 search_button = driver.find_element_by_css_selector("#su") search_button.click() # 等待搜索结果加载完成 driver.implicitly_wait(5) # 获取搜索结果列表的HTML内容 search_results_html = driver.find_element_by_css_selector("body").get_attribute("innerHTML") # 关闭浏览器 driver.quit() # 将HTML内容保存为PDF文件 pdfkit.from_string(search_results_html, "search_results.pdf") ``` 运行以上代码后,它将会将搜索结果保存为名为`search_results.pdf`的PDF文件。请确保`pdfkit`和`wkhtmltopdf`都已正确安装,并且`wkhtmltopdf`的路径已添加到系统环境变量中。
阅读全文

相关推荐

import os import time import platform from selenium import webdriver as webdriver1 from selenium.webdriver.ie.options import Options from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from config import global_wait,root_url,use_edge,iedriver_path,edgedriver_path,chromedriver_path from public.basiclogger import LOGGING class BaseCase(object): '''基础用例''' def get_web_driver(self,url,data=None,browser='ie'): if browser=='chrome': #if platform.system()=="Windows": # os.system(r'taskkill /f /im chrome.exe') #else: # os.system(r"ps aux |grep chrome|awk '{print $2}'|xargs -i kill {}") options = webdriver1.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-logging']) self.driver = webdriver1.Chrome(executable_path=chromedriver_path,options=options) self.driver.get(url) self.driver.maximize_window() self.driver.implicitly_wait(global_wait) else: #启动IE之前先杀死电脑上所有的IE if use_edge: os.system(r'taskkill /f /im msedge.exe') else: os.system(r'taskkill /f /im iexplore.exe') if use_edge: file1=edgedriver_path else: file1=iedriver_path options = Options() options.ignore_protected_mode_settings = True options.ignore_zoom_level = True if use_edge: options.attach_to_edge_chrome = True options.edge_executable_path = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" else: options.add_argument('--user-agent="Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"') self.driver=webdriver1.Ie(executable_path=file1,options=options) self.driver.get(url) self.driver.maximize_window() self.driver.implicitly_wait(global_wait) def get_logger(self): #创建日志文件名 filename=self.data["case_name"]+'_'+time.strftime("%Y-%m-%d_%H-%M-%S") #保存连接 filename1=os.path.join(r'test_log',filename+r'.log') LOGGING1=LOGGING(log_name=filename,log_dir="test_log") self.logger=LOGGING1.logObject self.LOGGER=LOGGING1

"D:\Program Files\python\python.exe" D:\pcWJ\测试项目\0324.py Traceback (most recent call last): File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 64, in _binary_paths raise ValueError(f"The path is not a valid file: {path}") ValueError: The path is not a valid file: D:\Program Files\Google\Chrome\Application\chromedriver.exe The above exception was the direct cause of the following exception: Traceback (most recent call last): File "D:\pcWJ\测试项目\0324.py", line 15, in <module> driver = webdriver.Chrome(service=service) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__ if finder.get_browser_path(): ^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path return self._binary_paths()["browser_path"] ^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths raise NoSuchDriverException(msg) from err selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location 进程已结束,退出代码为 1

"D:\Program Files\python\python.exe" D:\pcWJ\测试项目\cs.py The chromedriver version (101.0.4951.41) detected in PATH at D:\download\火狐下载\chromedriver.exe might not be compatible with the detected chrome version (134.0.6998.178); currently, chromedriver 134.0.6998.165 is recommended for chrome 134.*, so it is advised to delete the driver in PATH and retry Traceback (most recent call last): File "D:\pcWJ\测试项目\cs.py", line 5, in <module> driver = webdriver.Chrome() ^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 101 Current browser version is 134.0.6998.178 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe Stacktrace: Backtrace: Ordinal0 [0x00F1B8F3+2406643] Ordinal0 [0x00EAAF31+1945393] Ordinal0 [0x00D9C748+837448] Ordinal0 [0x00DBC8B3+968883] Ordinal0 [0x00DB84BA+951482] Ordinal0 [0x00DB5D71+941

C:\Users\dupeng\PycharmProjects\pythonProject\.venv\Scripts\python.exe C:\Users\dupeng\PycharmProjects\pythonProject\自动.py C:\Users\dupeng\PycharmProjects\pythonProject\自动.py:7: SyntaxWarning: invalid escape sequence '\P' driver = webdriver.Chrome("C:\Program Files\Google\Chrome\Application\chrome.exe")#加载谷歌驱动 Traceback (most recent call last): <unknown>:2: SyntaxWarning: invalid escape sequence '\P' <unknown>:1: SyntaxWarning: invalid escape sequence '\P' File "C:\Users\dupeng\PycharmProjects\pythonProject\自动.py", line 7, in <module> driver = webdriver.Chrome("C:\Program Files\Google\Chrome\Application\chrome.exe")#加载谷歌驱动 File "C:\Users\dupeng\PycharmProjects\pythonProject\.venv\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( ~~~~~~~~~~~~~~~~^ browser_name=DesiredCapabilities.CHROME["browserName"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... keep_alive=keep_alive, ^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\dupeng\PycharmProjects\pythonProject\.venv\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 51, in __init__ if finder.get_browser_path(): ~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\dupeng\PycharmProjects\pythonProject\.venv\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path return self._binary_paths()["browser_path"] ~~~~~~~~~~~~~~~~~~^^ File "C:\Users\dupeng\PycharmProjects\pythonProject\.venv\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 56, in _binary_paths browser = self._options.capabilities["browserName"] ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'capabilities' 进程已结束,退出代码为 1

C:\Users\邓奎林\AppData\Local\Programs\Python\Python311\python.exe C:/Users/邓奎林/PycharmProjects/pythonProject2/dkl/templates/test_notepad_ui.py Traceback (most recent call last): File "C:\Users\邓奎林\AppData\Roaming\Python\Python311\site-packages\selenium\webdriver\common\driver_finder.py", line 64, in _binary_paths raise ValueError(f"The path is not a valid file: {path}") ValueError: The path is not a valid file: C:\path\to\chromedriver.exe The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\邓奎林\PycharmProjects\pythonProject2\dkl\templates\test_notepad_ui.py", line 62, in <module> tester.setup_method() File "C:\Users\邓奎林\PycharmProjects\pythonProject2\dkl\templates\test_notepad_ui.py", line 17, in setup_method self.driver = webdriver.Chrome(service=service, options=chrome_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\邓奎林\AppData\Roaming\Python\Python311\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "C:\Users\邓奎林\AppData\Roaming\Python\Python311\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__ if finder.get_browser_path(): ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\邓奎林\AppData\Roaming\Python\Python311\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path return self._binary_paths()["browser_path"] ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\邓奎林\AppData\Roaming\Python\Python311\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths raise NoSuchDriverException(msg) from err selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location Process finished with exit code 1

"D:\Program Files\python\python.exe" D:\pcWJ\测试项目\0324.py Traceback (most recent call last): File "D:\pcWJ\测试项目\0324.py", line 14, in <module> driver = webdriver.Chrome(service=service) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 134 Current browser version is 130.0.6723.70 with binary path D:\Program Files\Google\Chrome\Application\chrome.exe Stacktrace: GetHandleVerifier [0x00007FF74CC64C25+3179557] (No symbol) [0x00007FF74C8C88A0] (No symbol) [0x00007FF74C7591CA] (No symbol) [0x00007FF74C79D58D] (No symbol) [0x00007FF74C79C5CB] (No symbol) [0x00007FF74C796700] (No symbol) [0x00007FF74C791CCD] (No symbol) [0x00007FF74C7E5E8B] (No symbol) [0x00007FF74C7E5460] (No symbol) [0x00007FF74C7D7A03] (No symbol) [0x00007FF74C7A06D0] (No symbol) [0x00007FF74C7A1983] GetHandleVerifier [0x00007FF7

"D:\Program Files\python\python.exe" D:\pcWJ\测试项目\0324.py Traceback (most recent call last): File "D:\pcWJ\测试项目\0324.py", line 8, in <module> browser = webdriver.Chrome('D:/Program Files/Google/Chrome/Application/chromedriver.exe') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__ RemoteWebDriver.__init__( File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute response = self.command_executor.execute(driver_command, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 374, in execute return self._request(command_info[0], url, body=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 397, in _request resp = self._conn.request(method, url, body=body, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\urllib3\_request_methods.py", line 144, in request return self.request_encode_body( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\urllib3\_request_methods.py", line 279, in request_encode_body return self.urlopen(method, url, **extra_kw) ^^^^^^^^^^^^^^^^^^^^^

C:\Users\duoqi\PycharmProjects\pythonTest\.venv\Scripts\python.exe C:\Users\duoqi\PycharmProjects\pythonTest\TieBaSpider\TiebaSpider.py The chromedriver version (131.0.6778.265) detected in PATH at C:\Program Files\Google\Chrome\Application\chromedriver.exe might not be compatible with the detected chrome version (133.0.6943.143); currently, chromedriver 133.0.6943.141 is recommended for chrome 133.*, so it is advised to delete the driver in PATH and retry Traceback (most recent call last): File "C:\Users\duoqi\PycharmProjects\pythonTest\TieBaSpider\TiebaSpider.py", line 2, in <module> driver = webdriver.Chrome() File "C:\Users\duoqi\PycharmProjects\pythonTest\.venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "C:\Users\duoqi\PycharmProjects\pythonTest\.venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) File "C:\Users\duoqi\PycharmProjects\pythonTest\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) File "C:\Users\duoqi\PycharmProjects\pythonTest\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] File "C:\Users\duoqi\PycharmProjects\pythonTest\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) File "C:\Users\duoqi\PycharmProjects\pythonTest\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 131 Current browser version is 133.0.6943.143 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe Stacktrace: GetHandleVerifier [0x00007FF7255F80C5+2992405] (No symbol) [0x00007FF72528BFA0] (No symbol) [0x00007FF72512590A] (No symbol) [0x00007FF725167662] (No symbol) [0x00007FF7251666CB] (No symbol) [0x00007FF7251609E3] (No symbol) [0x00007FF72515BC39] (No symbol) [0x00007FF7251AA6AC] (No symbol) [0x00007FF7251A9C90] (No symbol) [0x00007FF72519F113] (No symbol) [0x00007FF72516A918] (No symbol) [0x00007FF72516BA81] GetHandleVerifier [0x00007FF725656A1D+3379821] GetHandleVerifier [0x00007FF72566C31D+3468141] GetHandleVerifier [0x00007FF725660033+3418243] GetHandleVerifier [0x00007FF7253EC75B+847787] (No symbol) [0x00007FF72529754F] (No symbol) [0x00007FF725292F94] (No symbol) [0x00007FF72529312D] (No symbol) [0x00007FF725282949] BaseThreadInitThunk [0x00007FFA1243E8D7+23] RtlUserThreadStart [0x00007FFA138BBF2C+44] 进程已结束,退出代码为 1

"D:\Program Files\python\python.exe" D:\pcWJ\测试项目\0324.py D:\pcWJ\测试项目\0324.py:5: SyntaxWarning: invalid escape sequence '\P' browser = webdriver.Chrome('D:\Program Files\Google\Chrome\Application\chromedriver.exe') Traceback (most recent call last): File "D:\pcWJ\测试项目\0324.py", line 5, in <module> browser = webdriver.Chrome('D:\Program Files\Google\Chrome\Application\chromedriver.exe') D:\pcWJ\测试项目\0324.py:1: SyntaxWarning: invalid escape sequence '\P' # -*- coding: utf-8 -*- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__ RemoteWebDriver.__init__( File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute response = self.command_executor.execute(driver_command, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 374, in execute return self._request(command_info[0], url, body=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 397, in _request resp = self._conn.request(method, url, body=body, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\python\Lib\site-packages\urllib3\_request_methods.py", line 144, in request return sel

Traceback (most recent call last): File "C:\Users\Administrator\Desktop\PY日志\test.py", line 7, in <module> driver = webdriver.Chrome(service=service,options=options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\Desktop\pythonProject\.venv\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "C:\Users\Administrator\Desktop\pythonProject\.venv\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) File "C:\Users\Administrator\Desktop\pythonProject\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) File "C:\Users\Administrator\Desktop\pythonProject\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\Desktop\pythonProject\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) File "C:\Users\Administrator\Desktop\pythonProject\.venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 108 Current browser version is 14.1.1278.0 with binary path C:\Users\Administrator\AppData\Roaming\360se6\Application\360se.exe Stacktrace: Backtrace: (No symbol) [0x0068F243] (No symbol) [0x00617FD1] (No symbol) [0x0050D04D] (No symbol) [0x0052F6B4] (No symbol) [0x0052A97C] (No symbol) [0x005282E9] (No symbol) [0x0055F056] (No symbol) [0x0055EB2A] (No symbol) [0x00558386] (No symbol) [0x0053163C] (No symbol)

C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\python.exe C:\Users\jikaiyao\PycharmProjects\PythonProject\chrome.py Traceback (most recent call last): File "C:\Users\jikaiyao\PycharmProjects\PythonProject\chrome.py", line 11, in <module> driver = webdriver.Chrome(service=service) File "C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( ~~~~~~~~~~~~~~~~^ browser_name=DesiredCapabilities.CHROME["browserName"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... keep_alive=keep_alive, ^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "C:\Users\jikaiyao\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 135 Current browser version is 137.0.7151.104 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe Stacktrace: GetHandleVerifier [0x00007FF6420F53C5+78597] GetHandleVerifier [0x00007FF6420F5420+78688] (No symbol) [0x00007FF641EA91AA] (No symbol) [0x00007FF641EED1CF] (No symbol) [0x00007FF641EEC21B] (No symbol) [0x00007FF641EE65A8] (No symbol) [0x00007FF641EE1A5D] (No symbol) [0x00007FF641F351E5] (No symbol) [0x00007FF641F347A0] (No symbol) [0x00007FF641F26EC3] (No symbol) [0x00007FF641EF03F8] (No symbol) [0x00007FF641EF1163] GetHandleVerifier [0x00007FF64239EF7D+2870973] GetHandleVerifier [0x00007FF642399728+2848360] GetHandleVerifier [0x00007FF6423B6A03+2967875] GetHandleVerifier [0x00007FF64211020A+188746] GetHandleVerifier [0x00007FF6421184EF+222255] GetHandleVerifier [0x00007FF6420FD344+111236] GetHandleVerifier [0x00007FF6420FD4F2+111666] GetHandleVerifier [0x00007FF6420E3619+5465] BaseThreadInitThunk [0x00007FFBF998E8D7+23] RtlUserThreadStart [0x00007FFBFB99C34C+44] 进程已结束,退出代码为 1

"D:\Program Files (x86)\Python313\python.exe" C:\Users\Administrator\PycharmProjects\PythonProject\程序\1.py Traceback (most recent call last): File "C:\Users\Administrator\PycharmProjects\PythonProject\程序\1.py", line 73, in <module> steam_auto_login() ~~~~~~~~~~~~~~~~^^ File "C:\Users\Administrator\PycharmProjects\PythonProject\程序\1.py", line 20, in steam_auto_login driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options) File "D:\Program Files (x86)\Python313\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( ~~~~~~~~~~~~~~~~^ browser_name=DesiredCapabilities.CHROME["browserName"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... keep_alive=keep_alive, ^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "D:\Program Files (x86)\Python313\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files (x86)\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "D:\Program Files (x86)\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files (x86)\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "D:\Program Files (x86)\Python313\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary Stacktrace: Backtrace: GetHandleVerifier [0x00AFA813+48355] (No symbol) [0x00A8C4B1] (No symbol) [0x00995358] (No symbol) [0x009B1A9E] (No symbol) [0x009B0579] (No symbol) [0x009E0C55] (No symbol) [0x009E093C] (No symbol) [0x009DA536] (No symbol) [0x009B82DC] (No symbol) [0x009B93DD] GetHandleVerifier [0x00D5AABD+2539405] GetHandleVerifier [0x00D9A78F+2800735] GetHandleVerifier [0x00D9456C+2775612] GetHandleVerifier [0x00B851E0+616112] (No symbol) [0x00A95F8C] (No symbol) [0x00A92328] (No symbol) [0x00A9240B] (No symbol) [0x00A84FF7] BaseThreadInitThunk [0x75D47BA9+25] RtlInitializeExceptionChain [0x7726C2EB+107] RtlClearBits [0x7726C26F+191] 进程已结束,退出代码为 1 运行后也没有让我输入账号密码

最新推荐

recommend-type

计算机转专业申请书范文.doc

计算机转专业申请书范文.doc
recommend-type

springboot280基于WEB的旅游推荐系统设计与实现.zip

毕业设计 源代码 数据库 配套文档 答辩教程
recommend-type

springboot296基于个性化定制的智慧校园管理系统设计与开发.zip

毕业设计 源代码 数据库 配套文档 答辩教程
recommend-type

Visio实用教程:绘制流程图与组织结构

Microsoft Office Visio 是一款由微软公司出品的绘图软件,广泛应用于办公自动化领域,其主要功能是制作流程图、组织结构图、网络拓扑图、平面布局图、软件和数据库架构图等。Visio 使用教程通常包含以下几个方面的知识点: 1. Visio 基础操作 Visio 的基础操作包括软件界面布局、打开和保存文件、创建新文档、模板选择、绘图工具的使用等。用户需要了解如何通过界面元素如标题栏、菜单栏、工具栏、绘图页面和状态栏等进行基本的操作。 2. 分析业务流程 Visio 可以通过制作流程图帮助用户分析和优化业务流程。这包括理解流程图的构成元素,如开始/结束符号、处理步骤、决策点、数据流以及如何将它们组合起来表示实际的业务流程。此外,还要学习如何将业务流程的每个步骤、决策点以及相关负责人等内容在图表中清晰展示。 3. 安排项目日程 利用 Visio 中的甘特图等项目管理工具,可以为项目安排详细的日程表。用户需要掌握如何在 Visio 中创建项目时间轴,设置任务节点、任务持续时间以及它们之间的依赖关系,从而清晰地规划项目进程。 4. 形象地表达思维过程 通过 Visio 的绘图功能,用户可以将复杂的思维过程和概念通过图形化的方式表达出来。这涉及理解各种图表和图形元素,如流程图、组织结构图、思维导图等,并学习如何将它们组织起来,以更加直观地展示思维逻辑和概念结构。 5. 绘制组织结构图 Visio 能够帮助用户创建和维护组织结构图,以直观展现组织架构和人员关系。用户需掌握如何利用内置的组织结构图模板和相关的图形组件,以及如何将部门、职位、员工姓名等信息在图表中体现。 6. 网络基础设施及平面布置图 Visio 提供了丰富的符号库来绘制网络拓扑图和基础设施平面布置图。用户需学习如何使用这些符号表示网络设备、服务器、工作站、网络连接以及它们之间的物理或逻辑关系。 7. 公共设施设备的表示 在建筑工程、物业管理等领域,Visio 也可以用于展示公共设施布局和设备的分布,例如电梯、楼梯、空调系统、水暖系统等。用户应学习如何利用相关的图形和符号准确地绘制出这些设施设备的平面图或示意图。 8. 电路图和数据库结构 对于工程师和技术人员来说,Visio 还可以用于绘制电路图和数据库结构图。用户需要了解如何利用 Visio 中的电气工程和数据库模型符号库,绘制出准确且专业的电气连接图和数据库架构图。 9. Visio 版本特定知识 本教程中提到的“2003”指的是 Visio 的一个特定版本,用户可能需要掌握该版本特有的功能和操作方式。随着时间的推移,虽然 Visio 的核心功能基本保持一致,但每次新版本发布都会增加一些新特性或改进用户界面,因此用户可能还需要关注学习如何使用新版本的新增功能。 为了帮助用户更好地掌握上述知识点,本教程可能还包括了以下内容: - Visio 各版本的新旧功能对比和改进点。 - 高级技巧,例如自定义模板、样式、快捷键使用等。 - 示例和案例分析,通过实际的项目案例来加深理解和实践。 - 常见问题解答和故障排除技巧。 教程可能以 VISIODOC.CHM 命名的压缩包子文件存在,这是一个标准的 Windows 帮助文件格式。用户可以通过阅读该文件学习 Visio 的使用方法,其中可能包含操作步骤的截图、详细的文字说明以及相关的操作视频。该格式文件易于索引和搜索,方便用户快速定位所需内容。
recommend-type

【性能测试基准】:为RK3588选择合适的NVMe性能测试工具指南

# 1. NVMe性能测试基础 ## 1.1 NVMe协议简介 NVMe,全称为Non-Volatile Memory Express,是专为固态驱动器设计的逻辑设备接口规范。与传统的SATA接口相比,NVMe通过使用PCI Express(PCIe)总线,大大提高了存储设备的数据吞吐量和IOPS(每秒输入输出操作次数),特别适合于高速的固态存储设备。
recommend-type

AS开发一个 App,用户在界面上提交个人信息后完成注册,注册信息存入数 据库;用户可以在界面上输入查询条件,查询数据库中满足给定条件的所有数 据记录。这些数据记录应能够完整地显示在界面上(或支持滚动查看),如果 查询不到满足条件的记录,则在界面上返回一个通知。

### 实现用户注册与信息存储 为了创建一个能够处理用户注册并将信息存入数据库的应用程序,可以采用SQLite作为本地数据库解决方案。SQLite是一个轻量级的关系型数据库管理系统,在Android平台上广泛用于管理结构化数据[^4]。 #### 创建项目和设置环境 启动Android Studio之后新建一个项目,选择“Empty Activity”。完成基本配置后打开`build.gradle(Module)`文件加入必要的依赖项: ```gradle dependencies { implementation 'androidx.appcompat:appcompat:1
recommend-type

VC++图像处理算法大全

在探讨VC++源代码及其对应图像处理基本功能时,我们首先需要了解图像处理的基本概念,以及VC++(Visual C++)在图像处理中的应用。然后,我们会对所列的具体图像处理技术进行详细解读。 ### 图像处理基础概念 图像处理是指对图像进行采集、分析、增强、恢复、识别等一系列的操作,以便获取所需信息或者改善图像质量的过程。图像处理广泛应用于计算机视觉、图形学、医疗成像、遥感技术等领域。 ### VC++在图像处理中的应用 VC++是一种广泛使用的C++开发环境,它提供了强大的库支持和丰富的接口,可以用来开发高性能的图像处理程序。通过使用VC++,开发者可以编写出利用Windows API或者第三方图像处理库的代码,实现各种图像处理算法。 ### 图像处理功能详细知识点 1. **256色转灰度图**:将256色(即8位)的颜色图像转换为灰度图像,这通常通过加权法将RGB值转换成灰度值来实现。 2. **Hough变换**:主要用于检测图像中的直线或曲线,尤其在处理边缘检测后的图像时非常有效。它将图像空间的点映射到参数空间的曲线上,并在参数空间中寻找峰值来识别图像中的直线或圆。 3. **Walsh变换**:属于正交变换的一种,用于图像处理中的快速计算和信号分析。它与傅立叶变换有相似的特性,但在计算上更为高效。 4. **对比度拉伸**:是一种增强图像对比度的方法,通常用于增强暗区或亮区细节,提高整体视觉效果。 5. **二值化变换**:将图像转换为只包含黑和白两种颜色的图像,常用于文字识别、图像分割等。 6. **反色**:也称作颜色反转,即图像的每个像素点的RGB值取反,使得亮部变暗,暗部变亮,用于强调图像细节。 7. **方块编码**:一种基于图像块处理的技术,可以用于图像压缩、分类等。 8. **傅立叶变换**:广泛用于图像处理中频域的分析和滤波,它将图像从空间域转换到频域。 9. **高斯平滑**:用高斯函数对图像进行滤波,常用于图像的平滑处理,去除噪声。 10. **灰度均衡**:通过调整图像的灰度级分布,使得图像具有均衡的亮度,改善视觉效果。 11. **均值滤波**:一种简单的平滑滤波器,通过取邻域像素的平均值进行滤波,用来降低图像噪声。 12. **拉普拉斯锐化**:通过增加图像中的高频分量来增强边缘,提升图像的锐利度。 13. **离散余弦变换**(DCT):类似于傅立叶变换,但在图像压缩中应用更为广泛,是JPEG图像压缩的核心技术之一。 14. **亮度增减**:调整图像的亮度,使其变亮或变暗。 15. **逆滤波处理**:用于图像复原的一种方法,其目的是尝试恢复受模糊影响的图像。 16. **取对数**:用于图像显示或特征提取时的一种非线性变换,可将大范围的灰度级压缩到小范围内。 17. **取指数**:与取对数相反,常用于改善图像对比度。 18. **梯度锐化**:通过计算图像的梯度来增强边缘,使图像更清晰。 19. **图像镜像**:将图像左右或者上下翻转,是一种简单的图像变换。 20. **图像平移**:在图像平面内移动图像,以改变图像中物体的位置。 21. **图像缩放**:改变图像大小,包括放大和缩小。 22. **图像细化**:将图像的前景(通常是文字或线条)变细,以便于识别或存储。 23. **图像旋转**:将图像绕某一点旋转,可用于图像调整方向。 24. **维纳滤波处理**:一种最小均方误差的线性滤波器,常用于图像去噪。 25. **Canny算子提取边缘**:利用Canny算子检测图像中的边缘,是边缘检测中较为精确的方法。 26. **阈值变换**:通过设定一个或多个阈值,将图像转换为二值图像。 27. **直方图均衡**:通过拉伸图像的直方图来增强图像的对比度,是一种常用的图像增强方法。 28. **中值滤波**:用邻域像素的中值替换当前像素值,用于去除椒盐噪声等。 ### 总结 通过上述的知识点介绍,我们已经了解了VC++源代码在实现多种图像处理功能方面的重要性和实践。这些技术是图像处理领域的基础,对于图像处理的初学者和专业人士都具有重要的意义。在实际应用中,根据具体的需求选择合适的技术是至关重要的。无论是进行图像分析、增强还是压缩,这些技术和算法都是支撑实现功能的关键。通过VC++这样的编程环境,我们能够把这些技术应用到实践中,开发出高效、可靠的图像处理软件。
recommend-type

【固态硬盘寿命延长】:RK3588平台NVMe维护技巧大公开

# 1. 固态硬盘寿命延长的基础知识 ## 1.1 固态硬盘的基本概念 固态硬盘(SSD)是现代计算设备中不可或缺的存储设备之一。与传统的机械硬盘(HDD)相比,SSD拥有更快的读写速度、更小的体积和更低的功耗。但是,SSD也有其生命周期限制,主要受限于NAND闪存的写入次数。 ## 1.2 SSD的写入次数和寿命 每块SSD中的NAND闪存单元都有有限的写入次数。这意味着,随着时间的推移,SSD的
recommend-type

GDIplus创建pen

### 如何在GDI+中创建和使用Pen对象 在 GDI+ 中,`Pen` 类用于定义线条的颜色、宽度和其他样式。要创建 `Pen` 对象并设置其属性,可以按照如下方式进行: #### 创建基本 Pen 对象 最简单的方式是通过指定颜色来实例化一个新的 `Pen` 对象。 ```csharp using System.Drawing; // 使用纯色创建一个简单的黑色画笔 Pen blackPen = new Pen(Color.Black); ``` #### 设置线宽 可以通过传递第二个参数给构造函数来设定线条的粗细程度。 ```csharp // 定义一条宽度为3像素的红色线
recommend-type

操作系统课程设计的简化方法与实践

操作系统是计算机系统的核心软件,负责管理计算机硬件资源与软件资源,为应用程序提供服务,是用户与计算机硬件之间的接口。在计算机科学与技术的教育中,操作系统课程设计是帮助学生将理论知识与实践操作相结合的重要环节,它涉及操作系统的基本概念、原理以及设计实现方法。 ### 操作系统课程设计的目标与要求 课程设计的目标主要在于加深学生对操作系统核心概念和原理的理解,培养学生的系统分析和设计能力。通过设计实践,使学生能掌握操作系统的设计方法,包括进程管理、内存管理、文件系统以及I/O系统设计等。此外,课程设计还应指导学生学会使用相关软件工具,进行模拟或实验,以验证所设计的理论模型和算法。 ### 操作系统的核心组成 操作系统的四大核心组成部分包括: 1. **进程管理**:负责进程的创建、调度、同步与通信以及终止等操作,是操作系统管理计算机资源、提高资源利用率的重要手段。设计时,需要考虑进程的状态、进程控制块(PCB)、进程调度算法等关键概念。 2. **内存管理**:负责内存的分配、回收以及内存地址的映射,确保每个进程可以高效、安全地使用内存空间。涉及到的概念有物理内存和虚拟内存、分页系统、分段系统等。 3. **文件系统**:负责存储数据的组织、存储、检索以及共享等操作,是操作系统与数据存储设备之间的接口。设计文件系统时,需要考虑文件的结构、存储空间的管理以及文件的安全性与完整性。 4. **I/O系统**:负责管理计算机系统内外部设备的数据传输,是计算机系统输入输出的桥梁。设计I/O系统时,需要处理设备的分配与回收、I/O操作的调度以及缓冲管理等问题。 ### 操作系统课程设计的步骤 在进行操作系统课程设计时,通常可以遵循以下步骤: 1. **需求分析**:明确操作系统课程设计的目标和要求,分析用户需求,确定需要实现的操作系统功能和特性。 2. **系统设计**:根据需求分析结果,进行系统的总体设计,包括进程管理、内存管理、文件系统和I/O系统等部分的具体设计。 3. **模块划分**:将系统分解为若干模块,并明确各模块之间的接口和协作关系。 4. **算法设计**:针对各个模块,设计相应的算法和数据结构,如进程调度算法、内存分配策略、文件存储结构和I/O设备管理策略等。 5. **编码实现**:根据设计文档进行编码工作,选择合适的编程语言和开发工具,实现各个模块的功能。 6. **测试验证**:对实现的操作系统进行测试,包括单元测试、集成测试和系统测试,确保系统的稳定性和可靠性。 7. **文档编写**:撰写系统设计文档和用户手册,包括系统架构、模块功能、使用方法等内容。 8. **成果展示**:在课程结束时,展示操作系统的设计成果,进行系统功能演示,并对设计过程和结果进行总结和反思。 ### 操作系统课程设计的简单化方法 为了简化操作系统课程设计,可以采取一些方法: 1. **选择简单课题**:挑选一些基础而核心的课题进行设计,例如实现一个简单的进程调度器或者文件管理系统。 2. **使用模拟环境**:采用模拟软件或者仿真工具代替真实硬件环境进行实验,以简化硬件资源的管理。 3. **分模块实施**:将操作系统设计成独立的模块,逐步实现和测试,避免一次性处理所有复杂的问题。 4. **采用高级语言**:使用高级编程语言如C/C++或Java进行开发,可以减少对底层硬件操作的关注,更多地专注于操作系统的逻辑实现。 5. **限制功能范围**:为了减少复杂度,可以限定操作系统要实现的功能范围,专注于几个关键的、基础的特性。 ### 结语 操作系统课程设计是计算机科学教育中的一项重要内容,通过课程设计,学生可以更好地理解操作系统的原理,掌握操作系统的设计方法,提升编程能力和系统分析能力。设计简单化的操作系统课程,可以帮助学生更快地入门,为深入学习和研究操作系统打下坚实的基础。在设计时,应当充分考虑实际教学需求和学生的基础知识,选择合适的方法和工具,以实现教学目的。