2010-06-18 49 views
0

什么原因导致此线索的任何线索?selenium.open(“/”);生成一个XHR 500:内部服务器错误

+0

你可以给你更多的信息 - 堆栈跟踪,从你的测试案例摘录?你有没有调用selenium.setUp(url,browser)?你是否启动Selenium服务器? Selenium会抛出这个错误,还是Selenium在尝试访问URL时得到的Web服务器错误? – Domchi 2010-06-18 18:35:08

回答

0

谢谢。得到了solution..For谁在这个问题偶然任何其他人,这里是解决方案:

更换setUp(...)

Integer port = 4444; 
String browserString= "*firefox"; 
String url = "http://yoururl.com"; 
selenium = new DefaultSelenium("localhost",port,browserString,url) { 
public void open(String url) { commandProcessor.doCommand("open", new String[] {url,"true"});}; 
selenium.start(); 
1

这是Selenium RC 1.0.3中的一个已知问题。细节可以在这里找到:http://code.google.com/p/selenium/issues/detail?id=408

为1.0.3的解决方法是用一个经过一个布尔如设定为true第二个参数超负荷open命令。

或者,您可以等待发布新版本,但是大多数开发工作都集中在Selenium 2上。目前使用的是alpha版本,而最新版本(2.0a4)没有此问题。

1

这一次,我在Java中工作。 如果URL(如testurl)显示XHR响应代码500内部服务器错误,则不要使用selenium.open命令打开该URL。相反,请尝试selenium.openWindow。这样的事情:

selenium.open("http://google.com"); //or any site that will open without an error 
selenium.openWindow(testurl,"18"); 
selenium.selectWindow("18"); 
selenium.selectWindow("Google"); //or the window title of the site from step 1 above 
selenium.close(); 
selenium.selectWindow("18");