{"id":15650754,"url":"https://github.com/cssxsh/mirai-selenium-plugin","last_synced_at":"2025-04-14T00:43:22.731Z","repository":{"id":42374625,"uuid":"431121839","full_name":"cssxsh/mirai-selenium-plugin","owner":"cssxsh","description":"Mirai Console Selenium 前置插件","archived":false,"fork":false,"pushed_at":"2024-04-27T02:21:40.000Z","size":653,"stargazers_count":36,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T14:54:58.950Z","etag":null,"topics":["mirai","mirai-console","selenium"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cssxsh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-23T13:59:36.000Z","updated_at":"2024-08-03T19:51:13.000Z","dependencies_parsed_at":"2024-02-17T09:30:12.494Z","dependency_job_id":"9419afd4-3d22-4b61-ba62-941736c0e8c6","html_url":"https://github.com/cssxsh/mirai-selenium-plugin","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fmirai-selenium-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fmirai-selenium-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fmirai-selenium-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fmirai-selenium-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssxsh","download_url":"https://codeload.github.com/cssxsh/mirai-selenium-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804721,"owners_count":21164127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mirai","mirai-console","selenium"],"created_at":"2024-10-03T12:35:45.057Z","updated_at":"2025-04-14T00:43:22.713Z","avatar_url":"https://github.com/cssxsh.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Mirai Selenium Plugin](https://github.com/cssxsh/mirai-selenium-plugin)\n\n\u003e Mirai Selenium 前置插件\n\nMirai-Console 的前置插件，用于使用 Selenium 调用浏览器进行截图等\n\n[![maven-central](https://img.shields.io/maven-central/v/xyz.cssxsh.mirai/mirai-selenium-plugin)](https://search.maven.org/artifact/xyz.cssxsh.mirai/mirai-selenium-plugin)\n[![Setup and Build](https://github.com/cssxsh/mirai-selenium-plugin/actions/workflows/setup.yml/badge.svg)](https://github.com/cssxsh/mirai-selenium-plugin/actions/workflows/setup.yml)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/2ac22c6b3f4a4ce5a205971ad0e53412)](https://www.codacy.com/gh/cssxsh/mirai-selenium-plugin/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=cssxsh/mirai-selenium-plugin\u0026amp;utm_campaign=Badge_Grade)\n\n## 运行平台支持\n\n|   OS    | Browser | Driver | Setup |\n|:-------:|:-------:|:------:|:-----:|\n| Windows | Chrome  |  Yes   |  Yes  |\n| Windows | Firefox |  Yes   |  No   |\n| Windows |  Edge   |  Yes   |   ~   |\n|  Linux  | Chrome  |  Yes   |  Yes  |\n|  Linux  | Firefox |  Yes   |  Yes  |\n|  MacOS  | Chrome  |  Yes   |  Yes  |\n|  MacOS  | Firefox |  Yes   |  Yes  |\n\n在 `Linux` 下以 `headless` 模式运行时, 请安装 `Xvfb` 或其他虚拟窗口服务 [#8](https://github.com/cssxsh/mirai-selenium-plugin/issues/8)  \n可以通过 `xvfb-run -h` 测试是否已经安装\n\n## 在插件项目中引用\n\n```kotlin\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    compileOnly(\"xyz.cssxsh.mirai:mirai-selenium-plugin:${version}\")\n}\n\nmirai {\n    jvmTarget = JavaVersion.VERSION_11\n}\n```\n\n### 示例代码\n\n*   [kotlin](src/test/kotlin/xyz/cssxsh/mirai/test/MiraiSeleniumPluginTest.kt)\n*   [java](src/test/java/xyz/cssxsh/mirai/test/MiraiSeleniumPluginJavaTest.java)\n\n## 使用本前置插件的项目\n\n*   [BiliBili Helper](https://github.com/cssxsh/bilibili-helper)\n*   [GitHub Helper](https://github.com/gnuf0rce/github-helper)\n\n## 管理指令\n\n*   `/selenium setup` 安装驱动文件\n*   `/selenium clear` 清理驱动文件\n*   `/selenium destroy` 清理驱动进程\n*   `/selenium status` 驱动进程状态\n*   `/selenium firefox` 下载解压 firefox\n*   `/selenium chromium` 下载解压 chromium\n*   `/selenium chrome` 下载解压 chrome\n*   `/selenium chart` 测试 图表绘制功能，将以群员入群事件和发言时间为数据集\n\n## 配置\n\n### [MiraiSeleniumConfig.yml](src/main/kotlin/xyz/cssxsh/mirai/selenium/data/MiraiSeleniumConfig.kt)\n\n*   `expires` 驱动文件过期时间，默认一星期 (单位：天)\n*   `user_agent` 浏览器 UA\n*   `width` 浏览器宽度\n*   `height` 浏览器高度\n*   `pixel_ratio` 浏览器像素比\n*   `headless` 无头模式（后台模式）\n*   `proxy` 代理地址\n*   `log` 启用日志文件\n*   `browser` 指定使用的浏览器: `Chrome`,`Chromium`,`Firefox`,`Edge`\n*   `factory` 指定使用的Factory: `netty` （ktor 不再可用）\n*   `arguments` 自定义 arguments, 可以尝试加入 `--no-sandbox`, `--disable-dev-shm-usage`, 解决兼容性问题\n*   `preferences` 自定义 preferences，浏览器配置\n\n### [MiraiBrowserConfig.yml](src/main/kotlin/xyz/cssxsh/mirai/selenium/data/MiraiBrowserConfig.kt)\n\n*   `chrome` Chrome/Chromium 二进制文件路径\n*   `edge` Edge 二进制文件路径\n*   `firefox` Firefox 二进制文件路径\n\n## [MiraiSeleniumLoginSolver](src/main/kotlin/xyz/cssxsh/mirai/selenium/MiraiSeleniumLoginSolver.kt)\n\n本插件提供了 一个类似 [mirai-login-solver-selenium](https://github.com/project-mirai/mirai-login-solver-selenium) 的 登陆处理器  \n需要在 mirai 运行时中添加 JVM 属性 mirai.slider.captcha.supported (添加参数 -Dmirai.slider.captcha.supported) 启用\n\n## [ECharts](src/main/kotlin/xyz/cssxsh/selenium/ECharts.kt)\n\n`v2.2.2` 提供了方便调用 [ECharts](https://echarts.apache.org/) 进行表格绘制的工具类, 使用方法详见示例代码  \n`/selenium chart` 测试结果示例  \n![chart](examlpe/group.chart.png)\n\n## 安装\n\n### MCL 指令安装\n\n**请确认 mcl.jar 的版本是 2.1.0+**  \n`./mcl --update-package xyz.cssxsh.mirai:mirai-selenium-plugin --channel maven-stable --type plugin`\n\n### 手动安装\n\n1.  从 [Releases](https://github.com/cssxsh/mirai-selenium-plugin/releases) 或者 [Maven](https://repo1.maven.org/maven2/xyz/cssxsh/mirai/mirai-selenium-plugin/) 下载 `mirai2.jar`\n2.  将其放入 `plugins` 文件夹中\n\n## [爱发电](https://afdian.net/@cssxsh)\n\n![afdian](.github/afdian.jpg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssxsh%2Fmirai-selenium-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssxsh%2Fmirai-selenium-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssxsh%2Fmirai-selenium-plugin/lists"}