DrissionPage启动失败:如何解决“参数错误”问题?
drissionpage启动问题:参数错误
在使用drissionpage的chromiumpage时,遇到这样的错误回溯:
traceback (most recent call last): file "<module>", line 7, in <module> page = chromiumpage() file "d:hostipalmyvenvlibsite-packagesdrissionpagechromium_page.py", line 33, in __init__ super().__init__(addr_driver_opts, tab_id, timeout) file "d:hostipalmyvenvlibsite-packagesdrissionpagechromium_base.py", line 36, in __init__ self._connect_browser(address, tab_id) file "d:hostipalmyvenvlibsite-packagesdrissionpagechromium_page.py", line 46, in _connect_browser self.process = connect_browser(self._driver_options)[1] file "d:hostipalmyvenvlibsite-packagesdrissionpageunctionsrowser.py", line 41, in connect_browser debugger = _run_browser(port, chrome_path, args) file "d:hostipalmyvenvlibsite-packagesdrissionpageunctionsrowser.py", line 131, in _run_browser debugger = popen(arguments, shell=false) file "c:users8467ppdatalocalprogramspythonpython38libsubprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, file "c:users8467ppdatalocalprogramspythonpython38libsubprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.createprocess(executable, args, oserror: [winerror 87] 参数错误。
解决方法如下:
- 指定chrome路径
如果系统中有多个chrome浏览器路径,指定要使用的具体路径。可以使用以下代码:
from drissionpage import chromiumpage, chromiumoptions co = chromiumoptions().set_pahts(browser_path=r'你电脑chrome.exe路径') page = chromiumpage(addr_driver_opts=co) page.get('https://www.baidu.com')
- 升级drissionpage
尝试升级drissionpage,以解决潜在的兼容性问题:
pip install DrissionPage --upgrade
以上方法均可解决由于参数错误导致的drissionpage启动问题。
以上就是DrissionPage启动失败:如何解决“参数错误”问题?的详细内容,更多请关注硕下网其它相关文章!