官方网站 | https://www.easyspider.net |
---|---|
GIT地址 | https://github.com/NaiboWang/EasySpider |
GIT Star数 | 37393 |
开发语言 | JavaScript |
话题 | batch-processing, batch-script, code-free, crawler, data-collection, frontend, gui, html, input-parameters, layman, parameters, robotics, rpa, scraper, spider, visual, visualization, visualprogramming, web, www |
GIT信息最后更新日期 | 2025/02/14 07:37 |
许可 | Custom |
简介 | 一个可视化浏览器自动化测试/数据采集/爬虫软件,可以使用图形化界面,无代码可视化的设计和执行任务。只需要在网页上选择自己想要操作的内容并根据提示框操作即可完成任务的设计和执行。同时软件还可以单独以命令行的方式进行执行,从而可以很方便的嵌入到其他系统中。 |
https://github.com/NaiboWang/EasySpider/releases
sudo docker run -d -p 4444:4444 --name selenium-chrome --shm-size="4g" selenium/standalone-chrome
A 如不需要自己编译程序,则直接运行打包好的程序(需下载_with_docker_support
版本)即可:
git clone https://github.com/NaiboWang/EasySpider.git
cd EasySpider
./EasySpider/resources/app/chrome_linux64/easyspider_executestage --ids [0] --docker_driver http://localhost:4444/wd/hub --user_data 0 --server_address http://localhost:8074 --config_folder "./" --headless 1 --read_type local --config_file_name config.json --saved_file_name
B 如果需要自己修改源代码并运行程序,则执行下面的命令:
切换的本项目源码的ExecuteStage
文件夹,安装Python环境(Python版本需要为3.10或3.11):
pip3 install -r requirements.txt
然后执行任务:
python3 easyspider_executestage.py --ids [0] --docker_driver http://localhost:4444/wd/hub --user_data 0 --server_address http://localhost:8074 --config_folder "./" --headless 1 --read_type local --config_file_name config.json --saved_file_name
自行配置环境并运行程序的情况下,如提示Cannot find file ../ElectronJS/chrome_win64/stealth.min.js
的情况下,就在../ElectronJS
文件夹下手动建立一个chrome_win64
文件夹,再把ElectronJS
文件夹下的stealth.min.js
文件复制到chrome_win64
文件夹下即可,如果遇到其他同类错误则执行一样的操作。
命令行参数说明在此文档中:https://github.com/NaiboWang/EasySpider/wiki/Argument-Instruction
以上为local模式示例,在--docker_driver
后面写远程docker的网址,默认是http://localhost:4444/wd/hub
,--read_type local
则需要从本地的ExecuteStage/execution_instances
文件夹里读取0.json
文件,否则--read_type remote
的情况下会从--server_address http://localhost:8074
的服务器中读取任务信息。
一定要等到任务执行完成并自行退出,否则将会出现docker容器中的浏览器被占用而无法被其他任务使用的情况!!!如果碰到这种情况,请看下面的解决方案。
http://localhost:4444
来查看浏览器占用情况,一个浏览器只能被一个任务使用,如果意外退出程序但浏览器仍正被占用,导致无法被其他任务使用(命令行输出卡在Using remote driver
或Headless mode
)时,请重启docker镜像重置浏览器:sudo docker restart selenium-chrome
只有下图为0%时才可执行其他任务:
以上示例是同时只运行一个浏览器docker实例的情况,如需要同时运行多个浏览器示例以便多个任务同时执行,可以使用下面的解决方案:
sudo docker network create grid
sudo docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub
接下来,连接Chrome节点到Hub。可以根据需要启动任意数量的节点,下面是启动三个浏览器实例的命令:
sudo docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="4g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome
sudo docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="4g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome
sudo docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="4g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome
如果你需要更多的浏览器实例,可以重复上面的命令。
--docker_driver
后面写远程docker的网址,默认是http://localhost:4444/wd/hub
。http://localhost:4444
来查看浏览器占用情况,理论上应该有三个实例并显示占用情况: