我正在尝试使用 Selenium RC + Nunit + asp.net 测试我的网站。
我可以让我的测试在 Firefox、Safari、opera、IE 8 中运行,但不能在 google chrome 中运行。我将其放入浏览器参数中
selenium = new DefaultSelenium(Server, ServerPort,
"*chrome", DomainURL);
这总是会加载 Firefox,而不是好的 chrome。
最佳答案
如果我没记错的话,“*chrome
”用于启动 Firefox 的特殊模式 (在该模式下,您的应用程序拥有更多权限 -安全限制较少);因此,启动的是 Firefox,而不是 Google Chrome,这是正常的。
如果您想启动 Google Chrome,则必须使用“*chrome
”以外的其他名称。
在交互模式下使用 Selenium RC,如下所示:
$ java -jar selenium-server.jar -interactive
并且使用 getNewBrowserSession
命令不正确:
cmd=getNewBrowserSession
我得到了支持的浏览器列表:
23:43:09.317 INFO - Got result: Failed to start new browser session: Browser not supported:
(Did you forget to add a *?)
Supported browsers include:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
on session null
所以,我猜您应该能够使用“*googlechrome
”而不是“*chrome
”来启动 Google Chrome。
我不在 Windows 上,所以我无法自己尝试...而且我在文档中找不到任何支持我的内容...不过,运气好的话,这可能会对您有所帮助...
无论如何,祝你玩得开心!
作为旁注:实际上,Google Chrome 并不是发明“chrome”一词的人;这意味着plenty of things ,例如 Chrome Mozilla或User Interface Chrome
关于asp.net - 如何使用 Selenium RC 运行 Google Chrome?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1317055/