13 Replies Last post: Oct 28, 2008 10:34 AM by Andre Pretorius  
Andre Pretorius Beginner 8 posts since
Oct 6, 2008
Currently Being Moderated

Oct 6, 2008 5:51 AM

Is it possible to run selenium tests against a custom browser created in c# using Windows Form and webBrowser component?

Hi Andras,

 

I tried running the command you suggested but still receive the same error message SRC, please see steps below.

 

1. I created a c# Windows Form with a webBrowser component (which calls the IE ActiveX component) on the form which defaults to http://www.google.com

2. Next I setup my proxy Address to "localhost" and port to "4444" through Internet Explorer Settings and close Internet Explorer.

3. I then start my Selenium server and run the following command in prompt (pointing to the .exe created in step 1):

cmd=getNewBrowserSession&1=*custom C:\Users\...\My Web Browser\bin\Debug\MyWebBrowser.exe&2=http://www.google.com

 

4. Which opens my application successfully and gives me the following output in Selenium server prompt:

10:34:46.996 INFO - ---> Requesting http://localhost:4444/selenium-server/driver?cmd=getNewBrowserSession&1=*custom C:\Users\...\My Web Browser\bin\Debug\MyWebBrowser.exe&2=http://ww.google.com
10:34:47.013 INFO - Checking Resource aliases
10:34:47.016 INFO - Command request: getNewBrowserSession[*custom C:\Users\...\My Web Browser\bin\Debug\MyWebBrowser.exe, http://www.google.com] on session null
10:34:47.017 INFO - creating new remote session
10:34:47.052 INFO - Allocated session d6a52dc5d7d44ce5b1396aa113af99ea for http://www.google.com, launching...

 

5. I then run the following command:

cmd=open&1=http://www.google.com&sessionId=d6a52dc5d7d44ce5b1396aa113af99ea

(Note the same for 'cmd=open&1=http://www.google.com/webhp&sessionId=d6a52dc5d7d44ce5b1396aa113af99ea')

 

6. Which gives me the following message in Selenium server error:

10:35:29.920 INFO - ---> Requesting http://localhost:4444/selenium-server/driver?cmd=open&1=http://www.google.com&sessioId=d6a52dc5d7d44ce5b1396aa113af99ea
10:35:29.926 INFO - Command request: open[http://www.google.com, ] on session d6a52dc5d7d44ce5b1396aa113af99ea
10:35:29.927 ERROR - Exception running command
java.lang.NullPointerException
        at java.util.concurrent.ConcurrentHashMap.get(Unknown Source)
        at org.openqa.selenium.server.FrameGroupCommandQueueSet.getCommandQueue(FrameGroupCommandQueueSet.java:246)
        at org.openqa.selenium.server.FrameGroupCommandQueueSet.getCommandQueue(FrameGroupCommandQueueSet.java:204)
        at org.openqa.selenium.server.FrameGroupCommandQueueSet.doCommand(FrameGroupCommandQueueSet.java:421)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:529)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.j
ava:369)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:130)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at org.mortbay.http.HttpServer.service(HttpServer.java:909)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
10:35:29.929 INFO - Got result: ERROR Server Exception: null on session d6a52dc5d7d44ce5b1396aa113af99ea

 

Any help will be appreciated, I am not sure if I am missing another manual step in order to get this working.

Andras Hatvani Master 375 posts since
Oct 16, 2006

Hi Andre,

 

unfortunately this really is an issue - but only in the interactive mode; so I will reopen and appropriately modify the issue raised by you.

But since the interactive mode is rather a demo mode I'd suggest you to go on with a real test by using the .Net client driver:

 

Imports Selenium
Module TestModule
      Sub Main()
            Dim sel As DefaultSelenium = New DefaultSelenium("localhost", 4444, "custom C:\Users\...\My Web Browser\bin\Debug\MyWebBrowser.exe", "http://www.google.com")
            sel.Start()
            sel.Open("/")
            sel.Type("q", "hello world")
            sel.Click("btnG")
            sel.Stop()
      End Sub
End Module

 

Be aware that Google redirects to the country-specific domain thus, if you're not  in the U.S., then it will lead to a permission denied JS exception due to cross-site scripting restrictions in the open command.

So, if you're in another country, then change the TLD, which I marked red in the above code example.

Please also refer to http://selenium-rc.openqa.org/dotnet.html .

 

Andras

Andras Hatvani Master 375 posts since
Oct 16, 2006

Hello,

 

this error message means that SRC was able to invoke the desired browser process,

but is not able to interact with the in-browser Selenium Core instance.

In case of the *custom launcher it is mostly due to incorrect proxy configuration.

You have to manually configure your browser to use the SRC proxy at localhost:4444.

For further information refer in http://selenium-rc.openqa.org/tutorial.html to "Automatically

Launching Other Browsers".

 

Andras

Andras Hatvani Master 375 posts since
Oct 16, 2006

Hi Andre,

sorry, I somehow missed the proxy configuration part. The most efficient would be if you could send me the executable.

Andras

Andras Hatvani Master 375 posts since
Oct 16, 2006

Hi Andre,

 

where did you send the executable to? If the URL is hard-coded, then please set it to http://www.google.at.

 

Andras

Andras Hatvani Master 375 posts since
Oct 16, 2006

Andre,

 

I think the problem is that you load a hard-coded start page thus overriding the initial actions of the SRC custom launcher.

This is the reason why the TestRunner won't be loaded and why SRC is "waiting for window 'null' local frame 'null' for NNNN more secs"...

 

Andras

Andras Hatvani Master 375 posts since
Oct 16, 2006

Then I assume it is not supported by your browser to launch it by also externally specifying an URL as command line parameter.

This is still an application issue; look among the launchers in org.openqa.selenium.server.browserlaunchershow it works for current browsers and

make your browser configurable via command line.

 

Andras

More Like This

  • Retrieving data ...