1、Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: XP
Build info: version: '2.16.1', revision: '15405', time: '2012-01-05 12:30:12'
解决办法: 我们只要在WebDriver driver = new FirefoxDriver(); 前面指定我们浏览器的具体信息即可: System.setProperty ( "webdriver.firefox.bin" , "E:/Program Files/Mozilla Firefox/firefox.exe" ); WebDriver driver = new FirefoxDriver(); 2、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, seehttp://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded fromhttp://code.google.com/p/chromedriver/downloads/list
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:75)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at com.example.tests.Selenium2ForChrome.main(Selenium2ForChrome.java:18)
出现这个错误的原因是因为谷歌浏览器和selenium不是原生的,需要在谷哥里面装插件,插件下载地址是http://code.google.com/p/chromedriver/downloads/list。 暂时还没解决好。 3、The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see http://code.google.com/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://code.google.com/p/selenium/downloads/list 该问题的错误原因和上面的一样,用IEdriver的时候也需要装插件,去http://code.google.com/p/selenium/downloads/list 下载对应的插件版本,然后修改代码如下: [java] view plain copy
File file = new File("C:/Selenium/iexploredriver.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();
参考来源:http://stackoverflow.com/questions/10995314/driver-executable-must-be-set-by-the-webdriver-ie-driver-system-property 4、Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 119%. It should be set to 100% (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5.98 seconds 错误原因:IE浏览器的比例调大了,按ctrl+0,可以恢复原来的大小,即可。PS:这种错误真是。。。让人无语。 5、My97DatePicker控件输入日期问题 之前用的是seleniumIDE自己录制的代码,结果回放的时候总是说元素找不到,整的我很头疼,后来发现一个简单的办法,就是直接把值输入日期控件的输入框当中来, [java] view plain copy
driver.findElement(By.id("bookDay")).clear();
driver.findElement(By.id("bookDay")).sendKeys("2013-06-17"); 不过我觉得这个方法不好,还在寻找其他办法。
在网上找了下,有下面这个方法,问题是我看不懂。。。 http://lyh875.blog.163.com/blog/static/21428005820133192552198/
[java] view plain copy
selenium.selectFrame("relative=up");
//点击日期文本框
selenium.click("days");
//必须增加Thread.sleep(),不增加会报错,提示找不到下一条命令中的元素
//另,尝试使用waitForPageToLoad代替,会超时出错;
Thread.sleep(5000);
//当前为4月,向前移两个月
selenium.click("//div[@id='dpTitle']/div[2]");
selenium.click("//div[@id='dpTitle']/div[2]");
//点击2009-02-02
selenium.click("//td[@onclick='day_Click(2009,2,2);']");

selenium使用中遇到的问题的更多相关文章

  1. 浅析selenium的PageFactory模式

    前面的文章介绍了selenium的PO模式,见文章:http://www.cnblogs.com/qiaoyeye/p/5220827.html.下面介绍一下PageFactory模式. 1.首先介绍 ...

  2. [Python爬虫] Selenium+Phantomjs动态获取CSDN下载资源信息和评论

    前面几篇文章介绍了Selenium.PhantomJS的基础知识及安装过程,这篇文章是一篇应用.通过Selenium调用Phantomjs获取CSDN下载资源的信息,最重要的是动态获取资源的评论,它是 ...

  3. 浅析selenium的page object模式

    selenium目前比较流行的设计模式就是page object,那么到底什么是page object呢,简单来说,就是把页面作为对象,在使用中传递页面对象,来使用页面对象中相应的成员或者方法,能更好 ...

  4. Selenium自动化测试(java语言)

    Selenium介绍 Selenium 1.0 包含 core. IDE. RC. grid 四部分,  selenium 2.0 则是在两位大牛偶遇相互沟通决定把面向对象结构化( OOPP) 和便于 ...

  5. robotframework RF使用中需要安装的工具和库

    确保 Python 3.6.2 安装成功 安装 如下 RF使用中需要的工具和库 1. RF 在两个Python中安装 robotframework执行命令 pip install robotframe ...

  6. selenium中动作链的使用

    一.问题 我们有时候在使用selenium的时候,会遇到悬停后点击元素的操作,因此需要一个动作链来完成这个功能. 二.解决 从selenium的包中导入actionchains函数,利用xpath找到 ...

  7. 【Selenium专题】元素定位之一简单定位

    UI自动化工具千变万化.架构千变万化,但都逃离不开的关键一步就是元素定位.下面以Selenium为例介绍常见的几个元素定位方法 ID -元素id属性 WebElement El = driver.fi ...

  8. 使用 Selenium 实现基于 Web 的自动化测试

    (转自http://www.ibm.com/developerworks/cn/web/1209_caimin_seleniumweb/index.html) Selenium 是一个用于 Web 应 ...

  9. 浅析selenium的PageFactory模式 PageFactory初始化pageobject

    1.首先介绍FindBy类: For example, these two annotations point to the same element: @FindBy(id = "foob ...

随机推荐

  1. eclipse中android开发怎么修改xml文件字体大小

    windows->preference->General->appearence->Colors and Font->Basic->Text Font.点击右侧的E ...

  2. hdu 1035 Robot Motion(dfs)

    虽然做出来了,还是很失望的!!! 加油!!!还是慢慢来吧!!! >>>>>>>>>>>>>>>>> ...

  3. HDU4626+博弈

    博弈... /* 博弈 对于当前人来说,如果完成自己的操作后,若mat[n][m]==0,则自己是胜者. 因为 如果mat其他位置不存在1了,肯定自己胜:如果存在1,则让下一位去反转那个1. */ # ...

  4. 总想自己动动手系列·2·本地和外网(Liunx服务器上部署的web项目)按照自定义的报文格式进行交互(完结篇)

    一.准备工作 (1)创建一个web-project工程,部署本地可正常访问,部署在云服务上可访问. (2)理解如何在web.xml文件中配置过滤器,和创建一个自定义的过滤器. (3)懂得如何打war包 ...

  5. Unity3D 播放视频

    http://blog.csdn.net/jbjwpzyl3611421/article/details/12780625 导入: 影片纹理是通过Apple QuickTime导入的(支持.mov, ...

  6. alarm 和 sleep

    http://blog.sina.com.cn/s/blog_6a1837e90100uhl3.html alarm也称为闹钟函数,alarm()用来设置信号SIGALRM在经过参数seconds指定 ...

  7. Makefile之写demo时的通用Makefile写法

    Makefile之写demo时的通用Makefile写法[日期:2013-05-22] 来源:CSDN  作者:gqb666 [字体:大 中 小] 前面的一篇文章Makefile之大型工程项目子目录M ...

  8. 探索Python F-strings是如何工作

    PEP 498 提出一种新型字符串格式化机制,被称为“字符串插值”或者更常见的一种称呼是F-strings(主要因为这种字符串的第一个字母是f).F-strings提供了一种明确且方便的方式将pyth ...

  9. .Net Excel 导出图表Demo(柱状图,多标签页) .net工具类 分享一个简单的随机分红包的实现方式

    .Net Excel 导出图表Demo(柱状图,多标签页) 1 使用插件名称Epplus,多个Sheet页数据应用,Demo为柱状图(Epplus支持多种图表) 2 Epplus 的安装和引用 新建一 ...

  10. python --subprocess 范例

    范例1:查看ipconfig -all命令的输出,并将将输出保存到文件tmp.log中: import subprocess handle = open(r'd:\tmp.log','w') p=su ...