Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取动态快照失败 #20

Closed
AshleyHuang01 opened this issue Jun 2, 2022 · 4 comments
Closed

获取动态快照失败 #20

AshleyHuang01 opened this issue Jun 2, 2022 · 4 comments

Comments

@AshleyHuang01
Copy link

AshleyHuang01 commented Jun 2, 2022

#4 #8
尝试过上面两个issue的解决方法,但是无论是chromium还是firefox都获取快照失败了。。。作者大大可以帮忙看看吗

2022-06-02 15:27:31 W/bilibili-helper: 获取动态667078923002052612快照失败
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /root/POCHI_Bot/POCHI_Bot_Mirai/data/xyz.cssxsh.mirai.plugin.mirai-selenium-plugin/Chromium-v102.0.5005.63-r992738-portable-ungoogled-Lin64/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.4', revision: '535d840ee2'
System info: host: 'iZ2ze0v2pan6jjmveggccjZ', ip: '172.31.63.26', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-100-generic', java.version: '11.0.14.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --headless, --no-sandbox, --disable-dev-shm-usage], binary: /root/POCHI_Bot/POCHI_Bot_M..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --headless, --no-sandbox, --disable-dev-shm-usage], binary: /root/POCHI_Bot/POCHI_Bot_M..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}}]
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:164)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
        at mirai-selenium-plugin-2.1.0.jar//xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:400)
        at mirai-selenium-plugin-2.1.0.jar//xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:380)
        at mirai-selenium-plugin-2.1.0.jar//xyz.cssxsh.selenium.SeleniumToolKt.RemoteWebDriver(SeleniumTool.kt:109)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliUtilsKt.screenshot(BiliUtils.kt:378)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliUtilsKt.screenshot(BiliUtils.kt:241)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliUtilsKt.screenshot$default(BiliUtils.kt:239)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliContentKt.screenshot(BiliContent.kt:70)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliContentKt.content(BiliContent.kt:24)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliContentKt$content$1.invokeSuspend(BiliContent.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
        at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

2022-06-02 15:24:15 W/bilibili-helper: 获取动态667078141327441927快照失败
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Process unexpectedly closed with status 255
Build info: version: '4.1.4', revision: '535d840ee2'
System info: host: 'iZ2ze0v2pan6jjmveggccjZ', ip: '172.31.63.26', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-100-generic', java.version: '11.0.14.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {args: [-headless, --width=768, --height=1024, --hide-scrollbars, --headless, --no-sandbox, --disable-dev-shm-usage], prefs: {browser.aboutConfig.showWarning: false, fission.bfcacheInParent: true, fission.webContentIsolationStrategy: 0, general.useragent.override: Mozilla/5.0 (iPad; CPU OS 1..., general.warnOnAboutConfig: false, webgl.disabled: true}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {args: [-headless, --width=768, --height=1024, --hide-scrollbars, --headless, --no-sandbox, --disable-dev-shm-usage], prefs: {browser.aboutConfig.showWarning: false, fission.bfcacheInParent: true, fission.webContentIsolationStrategy: 0, general.useragent.override: Mozilla/5.0 (iPad; CPU OS 1..., general.warnOnAboutConfig: false, webgl.disabled: true}}, pageLoadStrategy: normal}}]
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:164)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:118)
        at mirai-selenium-plugin-2.1.0.jar//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:114)
        at mirai-selenium-plugin-2.1.0.jar//xyz.cssxsh.selenium.SeleniumInitKt$setupFirefoxDriver$3.invoke(SeleniumInit.kt:483)
        at mirai-selenium-plugin-2.1.0.jar//xyz.cssxsh.selenium.SeleniumInitKt$setupFirefoxDriver$3.invoke(SeleniumInit.kt:465)
        at mirai-selenium-plugin-2.1.0.jar//xyz.cssxsh.selenium.SeleniumToolKt.RemoteWebDriver(SeleniumTool.kt:109)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliUtilsKt.screenshot(BiliUtils.kt:378)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliUtilsKt.screenshot(BiliUtils.kt:241)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliUtilsKt.screenshot$default(BiliUtils.kt:239)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliContentKt.screenshot(BiliContent.kt:70)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliContentKt.content(BiliContent.kt:24)
        at bilibili-helper-1.5.0.jar//xyz.cssxsh.mirai.bilibili.BiliContentKt$content$1.invokeSuspend(BiliContent.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
        at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

yml配置文件如下:

# 驱动文件过期时间,默认一星期 (单位:天)
expires: 7
# 清理浏览器驱动,默认30 (单位:分钟)
destroy: 30
# 截图UA
user_agent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1'
# 截图宽度
width: 768
# 截图高度
height: 1024
# 无头模式(后台模式)
headless: true
# 代理地址
proxy: ''
# User Preferences
preferences: {}

# 启用日志文件
log: true
# 指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: 'Chromium'
# 指定使用的Factory
factory: ktor
# 自定义 arguments
arguments: [--headless, --no-sandbox, --disable-dev-shm-usage]

@cssxsh
Copy link
Owner

cssxsh commented Jun 2, 2022

请不要使用 root 用户 运行 程序

目前并没有比较好的方法处理 root 账户下 运行的问题

@cssxsh
Copy link
Owner

cssxsh commented Jun 2, 2022

对于 FirefoxDriver

试试 https://stackoverflow.com/questions/67090130
sudo apt-get install -y wget bzip2 libxtst6 packagekit-gtk3-module libx11-xcb-dev libdbus-glib-1-2 libxt6 libpci-dev

@cssxsh
Copy link
Owner

cssxsh commented Jul 6, 2022

github actions 测试是通过了的 (root 模式)

https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#installed-apt-packages

这个文档里 有已安装的包列表,你可以对比看看是不是缺少了什么

@cssxsh
Copy link
Owner

cssxsh commented Nov 6, 2022

似乎和 连接的ssh 客户端中开启了 x11 转发有关

@cssxsh cssxsh moved this to 🕊 in Mirai Plugin Nov 12, 2022
@cssxsh cssxsh closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2022
Repository owner moved this from 🕊 to 👌 in Mirai Plugin Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👌
Development

No branches or pull requests

2 participants