要把ChromeDriver放到代码中的文件夹中c://*******Application

public static WebDriver WebDriverRun(WebDriver driver){
//            System.setProperty(Dom4jXml.getValue("chromeDriverName"), Dom4jXml.getValue("chromeDriverPath"));
            // 设置 chrome 的路径  
            System.setProperty(  
                "webdriver.chrome.driver",  
                "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");  
            webdriver = new ChromeDriver(chromeOptions());
            
            // 转型为WebDriver, 统一类型,方便调用异常截图方法
            RuntimeServer runtime = new RuntimeServer();
            runtime.runtimeDriver(webdriver);
//            driver = chromeOptions();
            //driver = new FirefoxDriver();
            return webdriver;
    }
    
    /**
     * 禁止chrome弹出忽略网站证书错误提示
     * @return
     */
    public static ChromeOptions chromeOptions(){
            ChromeOptions options = new ChromeOptions();
//            DesiredCapabilities capabilities = DesiredCapabilities.chrome();
//            capabilities.setCapability("chrome.switches", Arrays.asList("--start-maximized"));
//            options.addArguments("--test-type", "--start-maximized");
            options.addArguments("--test-type", "--ignore-certificate-errors");
            
            return options;
    }

selenium启动Chrome浏览器和禁止证书错误提示弹出的更多相关文章

  1. Selenium启动Chrome浏览器提示“请停用以开发者模式运行的扩展程序”的解决办法

    安装了python selenium,运行下面代码: 1 from selenium import webdriver 2 3 browser = webdriver.Chrome() 4 brows ...

  2. selenium+python自动化100-centos上搭建selenium启动chrome浏览器headless无界面模式

    环境准备 前言 selenium在windows机器上运行,每次会启动界面,运行很不稳定.于是想到用chrome来了的headless无界面模式,确实方便了不少. 为了提高自动化运行的效率和稳定性,于 ...

  3. 用selenium启动chrome浏览器

    python 3.7 pycharm 1.安装selenium pip3 install selenium 2.下载与chrome匹配的chromdriver.exe,放到项目的解释器路径下,跟pyt ...

  4. selenium webdriver启动Chrome浏览器后无法输入网址的解决办法

    通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...

  5. 【Selenium专题】WebDriver启动Chrome浏览器(一)

    selenium操作chrome浏览器需要有ChromeDriver驱动来协助.一.什么是ChromeDriver?ChromeDriver是Chromium team开发维护的,它是实现WebDri ...

  6. Selenium 启动无头浏览器,只有chrome 和 firefox的,没有IE

    使用无头浏览器,可以避免掉不确定的弹出框对脚本稳定性的影响,还能在脚本执行过程中省略掉了css 加载的时间. 以下是Selenium 启动无头浏览器的方法,只有chrome 和 firefox的. p ...

  7. selenium启动Chrome时,加载用户配置文件

    selenium启动Chrome时,加载用户配置文件   Selenium操作浏览器是不加载任何配置的,网上找了半天,关于Firefox加载配置的多点,Chrome资料很少,下面是关于加载Chrome ...

  8. ChromeDriver启动Chrome浏览器后,地址栏只显示data;——chromeDriver版本不对

    ChromeDriver启动Chrome浏览器后,地址栏只显示data; 错误原因: chromeDriver版本不对,不同版本的chromeDriver对应不同版本的chrome浏览器 chrome ...

  9. selenium 启动ie 浏览器

    selenium 启动ie 浏览器 var driver = new InternetExplorerDriver(@"IEDriverServer.exe路径"); driver ...

随机推荐

  1. LeetCode Sum of Two Integers

    原题链接在这里:https://leetcode.com/problems/sum-of-two-integers/ 题目: Calculate the sum of two integers a a ...

  2. 日志管理-Log4net

    引言 log4net库是Apache log4j框架在Micorsoft.NET平台的实现,是一个帮组程序员将日志信息输出到各种目标(控制台.文件.数据库等)的工具.(百度百科) 实际项目中使用log ...

  3. Design and Analysis of Algorithms_Fundamentals of the Analysis of Algorithm Efficiency

    I collect and make up this pseudocode from the book: <<Introduction to the Design and Analysis ...

  4. poj 2393 Yogurt factory

    http://poj.org/problem?id=2393 Yogurt factory Time Limit: 1000MS   Memory Limit: 65536K Total Submis ...

  5. jmeter安装配置教程

    1.下载Jmeter 下载地址:http://jmeter.apache.org/download_jmeter.cgi 目前最新版为3.1,其余文件如源代码等也可从如下官网下载: http://jm ...

  6. sed

    命令行格式为:         sed [-nefri]  ‘command’  输入文本/文件 常用选项:        -n∶取消默认的输出,使用安静(silent)模式.在一般 sed 的用法中 ...

  7. 列表边框column-rule

    column-rule主要是用来定义列与列之间的边框宽度.边框样式和边框颜色.简单点说,就有点类似于常用的border属性.但column-rule是不占用任何空间位置的,在列与列之间改变其宽度不会改 ...

  8. Struts2下载文件点取消出现的异常解决

    struts2点击下载,如果正常下载不会报错,可是如果点击取消就会报如下的错误: Java.lang.IllegalStateException: Cannot call sendError() af ...

  9. LED将为我闪烁:控制发光二极管

      一个完整的linux驱动主要由内部处理和与硬件交互两部分组成.其中内部处理主要是指linux驱动的装载.卸载.与设备文件相关的动作处理以及业务逻辑等:与硬件交互主要是指通过iowrite32.io ...

  10. 安装Oracle问题总结

    Oracle安装很多次,这次是最郁闷. 第一次安装失败,考虑可能是软件问题(以往学生给的软件),重新从官网下载 快下载完时,360清理电脑垃圾空间,手残,关闭浏览器,又开始重新下载 下载的同时,我开始 ...