如何在Mozilla和IE驱动程序中添加参数

如何在Mozilla和IE驱动程序中添加参数

问题描述:

执行自动化脚本时,我正在浏览器中输入验证码页。 来克服,我们的开发团队提供了一个字符串,应通过URL传递以避免此验证。如何在Mozilla和IE驱动程序中添加参数

在Chrome中,我们使用了chrome选项方法来添加参数并使其适用于驱动程序。

鉴于如果我想在Mozilla & IE上执行我的工作,它会给出同样的错误。

代码段:

else if(browser.equals("Chrome")){ 
System.setProperty("webdriver.chrome.driver", RunConfig.CHROME_DRIVER_EXE); 
String userAgent = "******"; 
ChromeOptions co = new ChromeOptions(); 
co.addArguments("--user-agent=" + userAgent); 
DesiredCapabilities cap = DesiredCapabilities.chrome(); 
cap.setCapability(ChromeOptions.CAPABILITY , co); 
driver = new ChromeDriver(cap); 
driver.manage().window().maximize(); 
} 

对于铬上面的代码工作,我需要看我们如何为Mozilla和IE

运行
+3

请不要四下信息,请编辑您的问题,而不是 – Marged

能够做到这一点,我chaning可以是用户代理在Mozilla和Chrome中获得,但在IE中我们不能那样做。

我能够用曲线修复它与Chrome选项Chrome和Mozilla中