chromedriver selenium 问题处理
-
问题介绍:
make_snapshot(snapshot, pie.render(), outfile + '.' + suffix)该方法会使用chromedriver,并且有网络请求,下载数据,会导致制作镜像后相同的镜像出现不一致的情况,需要注意;
现在将网络请求下载的数据,提前下载到 bin/selenium, 打镜像的时候将数据拷贝到镜像里。吉凯pca问题记录:
Traceback (most recent call last): File "/usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/common/driver_finder.py", line 38, in get_path path = SeleniumManager().driver_location(options) if path is None else path File "/usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py", line 98, in driver_location output = self.run(args) File "/usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py", line 144, in run raise WebDriverException(f"Unsuccessful command executed: {command}.\n{result}{stderr}") selenium.common.exceptions.WebDriverException: Message: Unsuccessful command executed: /usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/common/linux/selenium-manager --browser chrome --output json. {'code': 65, 'message': 'request or response body error: operation timed out', 'driver_path': '', 'browser_path': ''} The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/envs/py310/bin/location_plot.py", line 127, in <module> pie_chart(getattr(args, 'output'), File "/usr/local/envs/py310/bin/location_plot.py", line 118, in pie_chart make_snapshot(snapshot, pie.render(), outfile + '.' + suffix) File "/usr/local/envs/py310/lib/python3.10/site-packages/pyecharts/render/snapshot.py", line 32, in make_snapshot content = engine.make_snapshot( File "/usr/local/envs/py310/lib/python3.10/site-packages/snapshot_selenium/snapshot.py", line 35, in make_snapshot driver = get_chrome_driver() File "/usr/local/envs/py310/lib/python3.10/site-packages/snapshot_selenium/snapshot.py", line 59, in get_chrome_driver return webdriver.Chrome(options=options) File "/usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__ super().__init__( File "/usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 51, in __init__ self.service.path = DriverFinder.get_path(self.service, options) File "/usr/local/envs/py310/lib/python3.10/site-packages/selenium/webdriver/common/driver_finder.py", line 41, in get_path raise NoSuchDriverException(msg) from err selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location ERROR:root:程序运行异常,/cephfs_data/genostack_v3/genostack_tool/public_data/2023/10/98bed7d1-fecd-ba4f-7b05-c2c29cb1a20a/output/proteinLocation/result/results.png 文件尚未生成 Traceback (most recent call last): File "/usr/local/envs/py310/lib/python3.10/site-packages/flask/app.py", line 1517, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/envs/py310/lib/python3.10/site-packages/flask/app.py", line 1503, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/workspace/app/views/ms_jk/protein_location.py", line 54, in protein_location records.stream_return_add(output + out_file + '.' + suffix) File "/usr/local/envs/py310/lib/python3.10/site-packages/hippo/web/models/data_analysis.py", line 122, in stream_return_add self._steam_return.add(filepath, labels, expand) File "/usr/local/envs/py310/lib/python3.10/functools.py", line 926, in _method return method.__get__(obj, cls)(*args, **kwargs) File "/usr/local/envs/py310/lib/python3.10/site-packages/hippo/web/components/StreamReturn.py", line 39, in _ select_list = self._append(filepath, label) File "/usr/local/envs/py310/lib/python3.10/site-packages/hippo/web/components/StreamReturn.py", line 69, in _append basename, basedir, filename = self._get_info_by_path(filepath) File "/usr/local/envs/py310/lib/python3.10/site-packages/hippo/web/components/StreamReturn.py", line 79, in _get_info_by_path raise Exception(f"程序运行异常,{filepath} 文件尚未生成") Exception: 程序运行异常,/cephfs_data/genostack_v3/genostack_tool/public_data/2023/10/98bed7d1-fecd-ba4f-7b05-c2c29cb1a20a/output/proteinLocation/result/results.png 文件尚未生成