如何通过System.setProperty()初始化多个版本的Geckodriver [英] How to initiate multiple versions of Geckodriver through System.setProperty()

查看:73
本文介绍了如何通过System.setProperty()初始化多个版本的Geckodriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道自己是否在监督什么,但是是否可以在同一个JVM中使用多个geckodriver版本?

I don't know if I'm overseeing something, but is it possible to use multiple geckodriver versions in the same JVM?

问题出在

System.setProperty("webdriver.gecko.driver", "path of the geckodriver1");
driver1 = new FirefoxDriver();

System.setProperty("webdriver.gecko.driver", "path of the geckodriver2");
driver2 = new FirefoxDriver();

我将在其中定义系统属性.对于单个实例,这没有问题并且可以正常工作,但是如何使用另一个geckodriver定义FirefoxDriver.进程将并行运行,因此全局设置会相互干扰.

where I would define a system property. For a single instance this is no problem and working fine, but how can I define a FirefoxDriver with another geckodriver. Processes would run parallel so global settings would interfere with each other.

我知道,您可以使用相同的驱动程序启动多个Firefox会话,但是我需要支持不同的Firefox版本,因此也在寻找具有多个geckodrivers的解决方案.

I know, that you can start multiple Firefox Session with the same driver, but I need to support different Firefox versions and am therefore looking for a solution with multiple geckodrivers as well.

感谢您的咨询.

推荐答案

系统属性

程序可以使用系统属性对象来在整个生命周期中保持其配置.

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆