-
Selenium 官方文档
https://www.selenium.dev/downloads/ -
准备工作:下载selenium-server
这里使用selenium-server-4.2.2.jar版本 -
Step 1: 下载chromedriver
打开http://chromedriver.storage.googleapis.com/index.html,找到对应chrome版本的chromedriver; -
Step 2: 找到对应版本下载
Mac下只有chromedriver_mac64.zip,m1需要下载对应m1版本> -
Step 3: 解压包
unzip chromedriver_mac64.zip -
Step 4: 添加chromedriver到系统环境变量中(这里以MAC为例)
将chromedriver放在/usr/bin或/usr/local/bin下面即可,这里通过创建软连接的方式
ln -s /Users/yourname/Downloads/chromedriver /usr/local/bin/chromedriver
注意:不添加的话 adding不会有chrome -
Step 5:启动 Standalone 模式
java -jar /Users/yourname/Downloads/selenium-server-4.2.2.jar standalone
可以看到启动了两种浏览器:chrome和safari
11:33:23.840 INFO [LogManager$RootLogger.log] - Using the system default encoding
11:33:23.844 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
11:33:24.433 INFO [NodeOptions.getSessionFactories] - Detected 12 available processors
11:33:24.479 INFO [NodeOptions.discoverDrivers] - Discovered 2 driver(s)
11:33:24.504 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome"} 12 times
11:33:24.505 INFO [NodeOptions.report] - Adding Safari for {"browserName": "safari"} 1 times
11:33:24.537 INFO [Node.<init>] - Binding additional locator mechanisms: name, relative, id
11:33:24.562 INFO [GridModel.setAvailability] - Switching Node bce477f6-ebc4-43dd-8380-197f2748f75a (uri: http://10.253.44.146:4444) from DOWN to UP
11:33:24.562 INFO [LocalDistributor.add] - Added node bce477f6-ebc4-43dd-8380-197f2748f75a at http://10.253.44.146:4444. Health check every 120s
11:33:24.785 INFO [Standalone.execute] - Started Selenium Standalone 4.2.2 (revision 683ccb65d6): http://10.253.44.146:4444
网友评论