selenium启动chrome,ie,Firefox浏览器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
//启动IE
System.setProperty("webdriver.ie.driver","D:\\Program
Files\\eclipse-SDK-win32\\selenium\\IEDriverServer.exe");
//注意上面是IEDriverServer.exe的文件存放路径
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORIN G_SECURITY_DOMAINS,true);
WebDriver driver = new InternetExplorerDriver(ieCapabilities);
//启动chrome
System.setProperty("webdriver.chrome.driver","D:\\Program
Files\\eclipse-SDK-win32\\selenium\\chromeDriverServer.exe");
ChromeDriver driver = new ChromeDriver();
//启动firefox
System.setProperty("webdriver.firefox.bin","D:\\Program Files\\Mozilla Firefox\\firefox.exe"); FirefoxProfile fp = new FirefoxProfile();
FirefoxDriver driver = new FirefoxDriver(fp);