zoukankan      html  css  js  c++  java
  • selenium 学习笔记 ---新手学习记录(2) 问题总结

    今天研究了下ie、chrome、firefox浏览器执行脚本

    1.首先firefox下执行时,我是安装在d盘了,所以要更改路径

     //如果火狐浏览器没有默认安装在C盘,需要制定其路径
     System.setProperty("webdriver.firefox.bin", "D:/Softwareinstallation/huohu/firefox.exe");
     WebDriver driver = new FirefoxDriver();

    2.在chrome下执行时,遇到了如下问题

    Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list

    解决方法:

    下载chrome驱动插件,(包含ie驱动插件),代码如下,还有问题的话,把路径加到path变量中

    http://yunpan.cn/c3kPMJTZDDLyv  访问密码 4dd5

    1 //谷歌浏览器
    2 System.setProperty("webdriver.chrome.driver", "C:\Users\Administrator\Desktop\testzidong\selenium\anzhuangbao\chromedriver_win32\chromedriver.exe");       
    3 WebDriver driver=new ChromeDriver();
    4         

    3.在ie下运行时出现上面类型问题。解决方法同上

    代码如下:

    1 System.setProperty("webdriver.ie.driver", "C:\Users\Administrator\Desktop\testzidong\selenium\anzhuangbao\IEDriverServer_x64_2.48.0\IEDriverServer.exe"); 
    2  WebDriver driver = new InternetExplorerDriver();

    但是在运行时又包了其他错。

    解决方法如下: 把ie选项中的安全区域全部打上钩

  • 相关阅读:
    数据库中总结2
    PyMySQL的基本使用
    数据库总结
    并发编程之多线程
    并发编程之多进程知识
    并发编程之多进程
    操作系统基础知识
    模块二总结
    Python函数进阶
    文件操作
  • 原文地址:https://www.cnblogs.com/kllay/p/5036932.html
Copyright © 2011-2022 走看看