78

I am trying to test my site with Selenium RC + Nunit + asp.net.

I can get my tests to work in Firefox,Safari,opera,IE 8 but not google chrome. I put this in for the browser arugment

 selenium = new DefaultSelenium(Server, ServerPort,
                                          "*chrome", DomainURL);

This always loads up Firefox though and not good chrome.

chobo2
  • 83,322
  • 195
  • 530
  • 832
  • The page your script is trying to open doesn't exist.So you are getting 404 error.You'll get same error when you run the test case in any of the browsers. – farheen Jan 04 '11 at 05:59

5 Answers5

132

If I remember correctly, "*chrome" is used to launch a special mode of Firefox (a mode in which your application has more privilegies -- with less security restrictions) ; so, the fact that it's Firefox that is launched, and not Google Chrome, is normal.

If you want to launch Google Chrome, you will have to use something else than "*chrome".


Using Selenium RC in interactive mode, with something like this :

$ java -jar selenium-server.jar -interactive

and using the getNewBrowserSession command not correctly :

cmd=getNewBrowserSession

I get the list of browsers is supports :

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

So, I'm guessing you should be able to launch Google Chrome using "*googlechrome" instead of "*chrome".


I'm not on Windows, so I can't try by myself... And I cannot find anything in the documentation to back me up... Still, with a bit of luck, this might help you...

Anyway, have fun !


As a sidenote : Google Chrome is not the one which invented the term "chrome", actually ; it means plenty of things, like Chrome Mozilla or User Interface Chrome

Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114
Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
  • Ya that worked. I just thought they shortened it to chrome or something like that. Thanks – chobo2 Aug 22 '09 at 21:56
  • I never used Google Chrome with Selenium RC, but I remembered having seen "*chrome" well before Google Chrome actually existed ; so, it seemed strange to use that to launch it ^^. You're welcome :-) Have fun! – Pascal MARTIN Aug 22 '09 at 22:01
  • Thanks very much, looked for solution for this for long time. – Rubycut Jan 26 '11 at 17:18
6

Using the browser *googlechrome is OK.

Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114
Harkue
  • 71
  • 1
  • 1
2

You can use *googlechrome else use *custom path_to_Chrome.exe file

Harshavardhan Konakanchi
  • 4,238
  • 6
  • 36
  • 54
2

Actually "*chrome" represented by Firefox browser.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Sudarsan
  • 31
  • 1
1

If you have added the chrome.exe path in to the path variable, give directly *googlechrome in place of *chrome else give the path of chrome.exe along with that.

Eg/

Selenium selenium = new DefaultSelenium("localhost",4444,"*googlechrome C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","http://www.google.com");
ChanGan
  • 4,254
  • 11
  • 74
  • 135