selenium chrome driver 和IE driver 常见问题(2)

本文档展示了在使用Selenium自动化测试时,如何配置Chrome和Internet Explorer的驱动程序。针对IE,特别强调了需要设置'webdriver.ie.driver'系统属性,并提供了错误处理的示例,同时提醒用户从Selenium官方网站下载最新的IEDriverServer.exe并将其路径添加到系统路径中。
摘要由CSDN通过智能技术生成
package com.selenium.test;
 import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
 public class TempGoogle {
        public static void main(String[] args) {
                final String sUrl = "http://www.google.com.hk/";            System.setProperty("webdriver.ie.driver","C:\\Users\\yren9\\workspace\\selenium\\IEDriverServer.exe");
            DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
            ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
            WebDriver oWebDriver = new InternetExplorerDriver(ieCapabilities);
            oWebDriver.get(sUrl);
            try {                        Thread.sleep(1000);
                } catch (InterruptedException e) {
                        /
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值