web自动化测试(java)---测试过程中遇到的错误合集
摸索测试,不管是安装、调测第一个用例都会遇到各种各样的问题,或是自己的问题或是程序本身设置问题
只有把所有问题记录下来,才对得起自己的经历
1、设置firefox的执行文件错误
Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
System info: host: 'YangYuchun-PC', ip: '192.168.202.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_171'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.Executable.<init>(Executable.java:72)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:59)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:55)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at seleniumTest.FirstSelenium.main(FirstSelenium.java:9)
默认情况下firefox安装路径在c盘不会出现这个问题,如果非C盘或者非默认安装,则需要指定执行文件所在目录,如下:
package seleniumTest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver; public class FirstSelenium {
public static void main(String args[]){
System.setProperty("webdriver.firefox.bin", "D:\\Program Files\\Mozilla Firefox\\firefox.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS);
driver.get("http://www.baidu.com"); driver.quit();
}
}
2、selenium版本不配套问题
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
pat@mozilla.org.xpi","e":true,"v":"1.1","st":1496964922348}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"D:\\Program Files\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"54.0","st":1496964922230}}}
1532870934632 addons.xpi DEBUG No changes found
1532870934642 addons.xpi DEBUG Registering manifest for D:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1532870934642 addons.xpi DEBUG Loading bootstrap scope from D:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1532870934648 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 2.0
1532870934650 addons.xpi DEBUG Registering manifest for D:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1532870934651 addons.xpi DEBUG Loading bootstrap scope from D:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1532870934654 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.50
1532870934654 addons.xpi DEBUG Registering manifest for D:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1532870934655 addons.xpi DEBUG Loading bootstrap scope from D:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1532870934659 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1532870934669 addons.xpi-utils DEBUG Starting async load of XPI database C:\Users\YANGYU~1\AppData\Local\Temp\anonymous2326053441094436722webdriver-profile\extensions.json
1532870934670 addons.xpi DEBUG Registering manifest for D:\Program Files\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1532870934671 addons.xpi DEBUG Loading bootstrap scope from D:\Program Files\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1532870934674 addons.xpi DEBUG Calling bootstrap method startup on screenshots@mozilla.org version 6.6.0
1532870934674 addons.xpi DEBUG Registering manifest for D:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1532870934675 addons.xpi DEBUG Loading bootstrap scope from D:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1532870934678 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.1
1532870934688 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1532870934689 addons.manager DEBUG Provider finished startup: XPIProvider
1532870934689 addons.manager DEBUG Starting provider: LightweightThemeManager
1532870934689 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1532870934689 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1532870934689 addons.manager DEBUG Starting provider: GMPProvider
1532870934696 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1532870934696 addons.manager DEBUG Provider finished startup: GMPProvider
1532870934696 addons.manager DEBUG Starting provider: PluginProvider
1532870934697 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1532870934697 addons.manager DEBUG Provider finished startup: PluginProvider
1532870934698 addons.manager DEBUG Completed startup sequence
1532870935048 addons.xpi-utils DEBUG Async JSON file read took 0 MS
1532870935049 addons.xpi-utils DEBUG Finished async read of XPI database, parsing...
1532870935052 addons.xpi-utils DEBUG Successfully read XPI database
1532870935065 addons.manager DEBUG Starting provider: <unnamed-provider>
1532870935065 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1532870935065 addons.manager DEBUG Provider finished startup: <unnamed-provider>
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1532870935179 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1532870935179 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1532870935179 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at seleniumTest.FirstSelenium.main(FirstSelenium.java:9)
之前使用python测试时,firefox上selenium版本为3.0.2.0(在菜单-附件组件中查看)
所以需要安装3.0.2.0或者以上版本的java selenium的jar包才可以。重新下载selenium的jar包并重新导入
web自动化测试(java)---测试过程中遇到的错误合集的更多相关文章
- java web添加mysql过程中遇到的错误及解决办法
问题一:遇到提示找不到驱动 com.mysql.jdbc.Driver 起初项目中是导入了mysql-connector-java-5.1.45-bin.jar 包的,但是一直依然报错,最后去官网 ...
- web自动化测试(java)---元素定位
和python类似,java-selenium也提供了很多种元素定位的方法,具体如下: findElement(By.id()) findElement(By.name()) findElement( ...
- web自动化测试(java)---环境搭建
java的测试环境搭建相较于python还简单些,只要把相关的jar包导入即可了 1.安装java 从官网下载最新的java安装程序,双击安装(java1.8) 2.下载java版的selenium的 ...
- openjdk:8u22-jre-alpine在java开发中的NullPointerException错误解决方案
问题描述 ** 在SpringBoot项目中使用了Ureport报表组件, 打包发布部署到docker中启动报错 ** java.lang.NullPointerException at sun.aw ...
- Web自动化测试python环境中安装 --selenium安装、火狐和火狐驱动版本、谷歌和谷歌驱动版本、测试
一.安装selenium Windows命令行(cmd)输入pip install selenium(无须指定版本默认最新)或 pip install selenium==3.141.0(可指定版本) ...
- Java面试题中的Redis大合集,所有你想找的都在这里!
概述 Redis 是一个开源的,基于内存的结构化数据存储媒介,可以作为数据库.缓存服务或消息服务使用.``` Redis 支持多种数据结构,包括字符串.哈希表.链表.集合.有序集合.位图.Hyperl ...
- JAVA NIO中selectedKeys返回的键集,对其中的SelectionKey执行操作之后,是否需要在selectedKeys()中对其执行remove 操作
今天一个东西需要用到java nio的东西.在网上查了一下资料,发现有Apache的Mina,Netty等,感觉JDK中带的NIO有点鸡肋啊.之前看过这部分的内容,但好长一段时间没有用,也就忘得七七八 ...
- springboot+freemarker毕业设计项目错误合集
1.springboot的主程序类必须在最外层. 换句话说,报错: This application has no explicit mapping for /error, so you are se ...
- Java工程师研发面经大合集
百度研发面经整合版 软件研发工程师 基础研发工程师 百度智能云 百度核心搜索部 百度今年的提前批有点奇怪,好像都不走流程,牛客上好几个百度内推的帖子,我投了几个,基本上都是百度智能云的,当然也有其他部 ...
随机推荐
- linux上部署Appach,让文件目录以网页列表形式访问
效果: 1.首先,需要安装Apache httpd服务 yum install -y httpd 2.查看或者设置httpd主配文件 vim /etc/httpd/conf/htpd.conf 从中可 ...
- 【Django】 TemplateDoesNotExist at /HTMLeditor/HTMLeditorHandler/
TemplateDoesNotExist at /HTMLeditor/HTMLeditorHandler/search/indexes/htmleditor/htmleditor_text.txt ...
- 2018 宁夏省赛 F. Moving On
题目链接 https://nanti.jisuanke.com/t/28406 大意是 有n(<=200)个城市,城市间有路(Input给了邻接矩阵) 每个城市有一个危险值,然后是q(2e4) ...
- eclipse中tomcat可以start启动,无法debug启动的解决
设置断点,进行程序调试,但是debug启动tomcat,却无法启动,并且会报超时异常. 原因可能是eclipse和tomcat启动时读取文件发生冲突 去掉所有的断点,然后重新debug启动,再设置断点 ...
- 检查mysql表是否损坏的脚本
#!/bin/bash#此脚本的主要用途是检测mysql服务器上所有的db或者单独db中的坏表#变量说明 pass mysql账户口令 name mysql账号名称 data_path mysql目录 ...
- Myeclipse中的tomcat项目的内存溢出
tomcat中 内存溢出 在这里写上 -Xmx1024M -Xms1024M -XX:NewSize=128m -XX:MaxNewSize=128m -XX:PermSize=128m -XX:Ma ...
- Chapter3_操作符_逻辑操作符
逻辑操作符与(&&)或(||)非(^)能够对布尔类型的数据类型进行操作,并且生成布尔值,和关系操作符的产生的数据类型是一样的.需要注意的不多,有以下几点: (1)在需要使用string ...
- 学习爬虫Scrapy遇到的错误
1. 这个问题是由于路径中含有中文,导致编码格式出错的问题, 查看错误方法,进入到ntpath.py文件中去,找到85行,然后,print 一下result_path,因为后面报出的错误,就是因为这段 ...
- left join on 和where中条件的放置位置
转自:http://blog.csdn.net/muxiaoshan/article/details/7617533 select * from td left join (select case_ ...
- python黑帽子-黑客与渗透测试编程之道(源代码)
链接: https://pan.baidu.com/s/1i5BnB5V 密码: ak9t