2010-06-18 59 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");