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: FirefoxDriverat 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: PreviousExperimentProviderat 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包并重新导入

 

转载于:https://www.cnblogs.com/watertaro/p/9387771.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/413642.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CentOS7 3.项目持续交付脚本

#停止原有工程 ps -ef | grep demo | grep -v grep | awk {print $2} | xargs kill#删除原有工程 rm -rf /opt/app/demo.jar#解压压缩包指定文件&#xff0c;并存入指定路径 #tar -zxf 压缩包 -C 解压到的路径 压缩包中指定文件名 tar -zxf /opt/app/demo.tgz -C /opt/app .…

工作312:uni-弹出框显示数据

<template><view class"wrap"><u-form :model"form" :rules"rules" ref"uForm" :errorType"errorType"><u-form-item label"标题" label-width"140" style"margin-left:30rp…

运算符和编码

格式化输出 现在有以下需求,让用户输入name, age, job,hobby 然后输出如下所⽰示:------------ info of Alex Li -----------Name : Alex LiAge : 22job : TeacherHobbie: girl------------- end -----------------你怎么实现呢&#xff1f;你会发现&#xff0c;用字符拼接的方…

CentOS7 2.新项目上线脚本

我司一个客户项目对应代码仓库的一个分支&#xff0c;每次新项目上线总是要从master复制一个分支&#xff0c;接着git clone到本地&#xff0c;在IDEA里面替换配置文件内容&#xff0c;上传到代码仓库&#xff0c;启动项目&#xff0c;配置nginx.conf&#xff0c;每次新项目上线…

工作312:uni-时间戳处理

第一步 <u-form-item label"结束时间" prop"endDate" label-width"200"><u-input type"select" v-model"form.endDate" placeholder"请选择" click"end_time_show true"></u-input>…

informix如何查询第一条记录

1.select first 1 * from shop;    正序查询第一条数据 2.select first 1 * from shop order by create_time desc;    按创建时间倒序查询第一条数据 3.select first 1 shopid from shop;    正序查询第一条数据中的shopid字段 4.select first 1 shopid from shop…

工作314:uni-提交成功加入表单验证

增加验证规则 <u-form :model"form" :rules"rules" ref"uForm" :errorType"errorType"><navigator url"../LevineHua-editor/LevineHua-editor" class"single"><u-form-item label"荣誉照片&…

HDOJ 1233 (克鲁斯卡尔+并查集)

还是畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 58011 Accepted Submission(s): 26354 Problem Description 某省调查乡村交通状况&#xff0c;得到的统计表中列出了任意两村庄间的距离。省政府“…

mysql8优化实战

最近上线了一个10万户的管理系统&#xff0c;以前的客户没有这么多用户量&#xff0c;隐藏在代码中的慢sql渐渐显现出来了。 下面是我最近一周慢sql优化的总结&#xff1a; 多表sql优化、count sql优化、超过10 0000条limit优化一、多表sql优化 二、count sql优化 该表有21350…

工作315:uni-修改添加时间的逻辑

第一步 <u-form-item label"开始日期" prop"startTime" label-width"150"><u-input type"select" :select-open"start_time_show" v-model"form.startTime" placeholder"请选择" click"…

javaScript高程笔记--最佳实践

1.可维护性 《1》什么是可维护的代码 (1)可理解性 (2)直观性 (3)可适应性 (4)可扩展性 (5)可调试性 《2》代码约定 (1)可读性---适当的进行注释【函数和方法、大段代码、复杂的算法、Hack浏览器差异性】 (2)变量和函数名--语义化 (3)变量类型透明---一眼看出来是什么类型的数据…

工作316:uni-修改其他页面的时间逻辑

<u-form-item label"内容" prop"container" label-width"140"><input placeholder"请输入内容" v-model"form.content" type"texarea" /></u-form-item>定义富文本输入跳转有数值 form: {cont…

工作317:uni-修改其他页面整体样式

<template><view class"wrap"><u-form :model"form" :rules"rules" ref"uForm" :errorType"errorType"><u-form-item label"标题" class"label-left" style"margin-left:30r…

犯犯错

1.忘记初始化&#xff0c;程序卡卡卡 2.忘记加多组输入输出 3.Tarjan处理的时候总是把根节点忘掉 4.主函数用数组从0开始&#xff0c;函数中从1开始用&#xff0c;导致凉凉 5.hdu返回TLE的时候记得考虑越界问题 6.memset可能被卡&#xff0c;T的时候想一想&#xff01; 转载于:…

工作318:uni-切换tabber修改状态修饰

onLoad() {/* 调用市场信息的接口 分别 vuex获取 其他三项 */this.$u.api.getTreasureList({marketId: this.vuex_user.market_id,pageNo: 1,pageSize: 20,type:this.current1,releaseBureau:this.releaseBureau,name:this.name}).then(res > {if (res.data.code 200) {thi…

python--循环列表中字典元素

1. 目的&#xff1a; > 实现列表中字典kay - value的遍历 代码&#xff1a; 循环列表中字典元素info_list [{name:zhao,age:22,hight:171},{name:qian,age:23,hight:165},{name:sun,age:24,hight:148},{name:li,age:25,hight:166} ]# 第一种方式 index 0 while index <…

工作320:uni-预加载问题

<u-loadmore :status"status" />onReachBottom() {console.log(触底~~~~)if (this.pageNo > this.pages){this.status nomore;return;} this.status loading;this.pageNo this.pageNo;setTimeout(() > {this.getData()if (this.pageNo > this.page…

js的基本包装类型

基本包装类型(包装对象)&#xff1a; 先看下以下代码&#xff1a; var s1 "helloworld"; var s2 s1.substr(4); 上面我们说到字符串是基本数据类型&#xff0c;不应该有方法&#xff0c;那为什么这里s1可以调用substr()呢&#xff1f; 通过翻阅js权威指南第3.6章节…

字节跳动小程序支付接入

字节跳动小程序支付接入躺过的坑流程签名支付宝配置问题java福利躺过的坑 流程 小程序申请流程业务调用流程 签名 请求字节跳动接口的签名请求预下单返回验签 支付宝配置问题 流程 小程序申请流程 字节跳动小程序开通申请有个渠道秘钥类型选择RSA2和RSA&#xff0c;不管你选择…

工作322:uni-扩展运算符实现拼接合并操作

}).then(res>{if (res.data.code 200) {/* 进行合并操作 */this.tableData [...this.tableData, ...res.data.data.records]this.pages res.data.data.pagesconsole.log(1)console.log(res)}})