如何使用Chrome选项启动chromebrowser? [英] How to launch chromebrowser using chrome options?
本文介绍了如何使用Chrome选项启动chromebrowser?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不使用System.setProperty
Without using The System.setProperty
System.setProperty("webdriver.chrome.driver", "F:\\New folder\\chromedriver.exe");
我尝试使用带有以下代码的chrome选项启动chrome浏览器:
I have tried to launch the chrome browser using chrome options with the below code:
ChromeOptions options = new ChromeOptions();
options.setAcceptInsecureCerts(true);
options.addArguments("disable-infobars");
driver = new ChromeDriver(options);
我已在我的系统变量中设置了chromedriver路径,但无法解决这个问题.
i have set my chromedriver path in my System variables.It not Working can any figure this out.
推荐答案
能否请您在Options
中将Binary
设置为以下代码来启动chromeBrowser:
Can you please try below code as set Binary
also into Options
to launch chromeBrowser:
ChromeOptions options = new ChromeOptions();
options.setBinary("C:\\Users\\raheela.aslam\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"); //Path where the Chrome.exe exist in your machine.
System.setProperty("webdriver.chrome.driver", "C:\\chrome_driver\\chromedriver.exe");
driver = new ChromeDriver(options);
这篇关于如何使用Chrome选项启动chromebrowser?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文