grid学习笔记

参考:

https://www.imooc.com/article/31609

https://blog.csdn.net/lb245557472/article/details/91966770    (3种方法实现)

 

 

grid官网下载

https://www.selenium.dev/downloads/

 

其他下载地址

http://selenium-release.storage.googleapis.com/index.html

 

 

启动主节点和子节点

java -jar /Users/lucax/Desktop/测/grid/selenium-server-standalone-3.141.59.jar -role hub -port 4444

控制面板地址:  http://localhost:4444/grid/console


java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.116.120:4444/grid/register/ -port 5577

 

启动代码

#coding=utf-8
import time
from selenium import webdriver

class a():
	def bb(self):
		ds = {'platform': 'ANY',
      'browserName': "chrome",
      'version': '',
      'javascriptEnabled': True,
      "maxSession":2
      }

		hostList=["http://192.168.116.120:5577/wd/hub","http://192.168.116.120:4444/wd/hub"]

		for i in hostList:
			print(i)
			dr = webdriver.Remote(command_executor=i,
			                  desired_capabilities=ds
			                  )

			dr.get("http://baidu.com/")
			time.sleep(3)
			print("走到这里")
			dr.quit()
			print("执行完毕")

if __name__ == '__main__':
	a().bb()

注意

下载浏览器driver,放到和selenium server相同的路径下,否则在启动node时要加参数,不然启动不了浏览器(java -Dwebdriver.chrome.driver="C:\your path\chromedriver.exe" -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.100:5566/grid/register/,可切换浏览器)

 

appium

https://www.bilibili.com/video/BV1oK411J7rq?spm_id_from=333.337.search-card.all.click

 

感觉只是调用远程设备而已,用到再看看

 

posted @ 2022-04-20 23:47  凯宾斯基  阅读(74)  评论(0)    收藏  举报