简体   繁体   中英

How to set Firefox Profile: Selenium RC, .Net Client Driver?

I'm using Selenium RC + .Net Client Driver. I've created a Firefox profile in my c:\\selenium\\ directory. Here's my code:

Dim MySelenium As ISelenium = Nothing
MySelenium = New DefaultSelenium("localhost", 4444, "*custom C:/Program Files/Mozilla Firefox/firefox.exe  -profile c:/selenium/", "http://www.google.com/") 

When I run this, I get the following error:

Failed to start new browser session: Error while launching browser

What is the proper way to do this?

You need to launch it via RC rather than in your code.

So you would do

java -jar selenium-server.jar -firefoxProfileTemplate c:\selenium\

to launch the browser and then do

Dim MySelenium As ISelenium = Nothing
MySelenium = New DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com/")

and that should launch Firefox for with the profile you want.

In Java you can create the Selenium Server programmatically and pass a File as the newFirefoxProfileTemplate configuration property:

RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setPort(5499);
rcc.setFirefoxProfileTemplate(newFirefoxProfileTemplate); // This is a File object
SeleniumServer server = new SeleniumServer(rcc);

server.start();

Perhaps there are similar (or the same) vb.net classes available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM