51Testing软件测试论坛

标题: selenium测试问题 [打印本页]

作者: dai~zi    时间: 2017-5-18 15:48
标题: selenium测试问题
在学习selenium1案例时 OPen本址文件时报异常,查询在网上一直没找到原因:
java代码
DefaultSelenium selenium=new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "https://www.baidu.com/index.php?tn=monline_3_dg");
selenium.start();
selenium.open("C:\\Users\\daixiaofei\\Desktop\\test.html");

报出来的异常:
Exception in thread "main" com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the user group at
https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.  The error message is: Component returned failure
code: 0x804b0012 (NS_ERROR_UNKNOWN_PROTOCOL) [nsIDOMLocation.href]
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:109)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:103)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:369)
at Class1.main(Class1.java:11)


页面显示的错误:

作者: yuyubill    时间: 2017-5-18 17:29
地址改成file:///C:/Users/daixiaofei/Desktop/test.html
作者: dai~zi    时间: 2017-5-22 11:13
yuyubill 发表于 2017-5-18 17:29
地址改成file:///C:/Users/daixiaofei/Desktop/test.html

试过了,还是有问题~~~ 网上找的方法都试过了~~
作者: lamecho    时间: 2017-6-1 15:16
建议了解pyswat框架,全程录制案例,不需要手写代码,自动生成测试case,回放即可实现自动化测试




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2