如何解决Selenium Chromium/chromedriver 依赖的 Discord JDA bot 不会在 VPS 上运行
我正在尝试将我的 discord JDA bot(它使用一些硒并且在我的 Windows 10 PC 上的 Intellij 中运行时运行良好)到我的 VPS 上,但是当我在我的 VPS 上运行 bot.jar 时,它给了我错误如下所示。
java.lang.IllegalStateException: The driver executable does not exist: /root/Blobot/C:\usr\bin\chromedriver.exe
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:146)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
at com.blob.discord.utilities.HtmlReader.findHedgehogImages(HtmlReader.java:39)
at com.blob.discord.utilities.HtmlReader.onStartup(HtmlReader.java:26)
at com.blob.discord.Core.main(Core.java:54)
我已按照本指南 (https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/) 将所有必需的 selenium、chrome、webdriver 和 java 所需的依赖项安装到我的 VPS 上。我还从 Discord 服务器上的某个人那里获得了支持,他告诉我从我的代码中删除 System.setProperty("webdriver.chrome.driver","C:\\usr\\bin\\chromedriver.exe");
行并让 Selenium 自动找到它,但这又给了我另一个错误:
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information,see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
他告诉我尝试运行此命令 apt install chromium-chromedriver
来手动安装它,但它又给了我另一个错误:
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount:
/tmp/sanity-mountpoint-425579461: mount failed: Operation not permitted.
dpkg: error processing archive /var/cache/apt/archives/chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb (--unpack):
new chromium-browser package pre-installation script subprocess returned error exit status 1
Selecting previously unselected package chromium-chromedriver.
Preparing to unpack .../chromium-chromedriver_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb ...
Unpacking chromium-chromedriver (1:85.0.4183.83-0ubuntu0.20.04.2) ...
Errors were encountered while processing:
/var/cache/apt/archives/chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
这是 VPS 问题还是我可以解决的问题?如果可以,如何解决?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。