我試圖使用PhantomJS作爲PHPUnit硒測試的瀏覽器。GhostDriver與PHPUnit
我已經將Selenium設置爲以網格模式運行,並使用webdriver啓動phantomjs,並將其註冊到網格中,如GhostDriver Readme中所述。
當我運行一個硒測試時,它會失敗並出現一個未知的命令錯誤 - GhostDriver只是不理解PHPUnit在說什麼。
[ERROR - 2013-05-12T16:23:06.326Z] RouterReqHand - _handle - Thrown => {
"message": "Request => {\"headers\":{\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"Content-Length\":\"85\",\"Content-Type\":\"application/x-www-form-urlencoded; charset=utf-8\",\"Host\":\"127.0.0.1:4444\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"post\":\"cmd=getNewBrowserSession&1=phantomjs&2=https%3A%2F%2Ftest.testurl.com%2F&\",\"url\":\"/\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"\",\"directory\":\"/\",\"path\":\"/\",\"relative\":\"/\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/\",\"queryKey\":{},\"chunks\":[\"\"]}}",
"name": "Unknown Command",
"line": 87,
"sourceId": 139810136032448,
"sourceURL": ":/ghostdriver/request_handlers/router_request_handler.js",
"stack": "Unknown Command: Request => {\"headers\":{\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"Content-Length\":\"85\",\"Content-Type\":\"application/x-www-form-urlencoded; charset=utf-8\",\"Host\":\"127.0.0.1:4444\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"post\":\"cmd=getNewBrowserSession&1=phantomjs&2=https%3A%2F%2FFtest.testurl.com%2F&\",\"url\":\"/\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"\",\"directory\":\"/\",\"path\":\"/\",\"relative\":\"/\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/\",\"queryKey\":{},\"chunks\":[\"\"]}}\n at :/ghostdriver/request_handlers/router_request_handler.js:87",
"stackArray": [
{
"sourceURL": ":/ghostdriver/request_handlers/router_request_handler.js",
"line": 87
}
]
}
這個同樣的問題被要求與建議,它的PHPUnit來歸咎於GhostDriver site關閉無人接聽。情況可能如此,但我仍然沒有做出這項工作。有沒有人有任何想法如何解決它?
感謝 - 說實話,速度和速度都比較慢,而且更多的是關於Selenium在去年不再使用Firefox的事實,並且沒有任何修復的跡象。我在絕望中尋找替代品。我想在這個新API中重寫測試是前進的方向。謝謝。 – Hippyjim 2013-07-01 13:40:02
FWIW,FF適合我。我是Selenium的新手,上週設置了整個shebang,所以我的機器上沒有遺留的東西。 Firefox開箱即用,IDE,獨立服務器,網格節點......甚至在Windows主機上;) – hashchange 2013-07-01 14:08:31
是的,但是Firefox和「無法訪問死對象」錯誤仍然存在問題。該頁面非常活躍,JS創建/替換元素。從Firefox 15開始,我就無法通過一個單獨的webdriver測試,但它不會因此而死亡。 – Hippyjim 2013-07-01 14:21:05