selenium - How to set Proxy Configuration in java code -


i'm trying program in java class start selenium server in case down reason. found here: http://www.testingexcellence.com/how-to-start-selenium-server-with-java-code/

i see if configuration parameters can set using class remotecontrolconfiguration , methods such setport, setlogoutfilename, settimeoutinseconds, ...

the problem selenium server connects proxy in way:

java -jar selenium-server.jar -dhttp.proxyhost=my.proxy.com -dhttp.proxyport=8080 

unfortunately, haven't found how put java code. question is: possible set proxyhost , proxyport values in java?

thanks time =)

}panacea{

the easiest way set them globally within jvm

system.setproperty("http.proxyhost", "yourproxyurl.com"); system.setproperty("http.proxyport", "80"); 

http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

however affects entire instance of jvm, other outgoing connections try use proxy. that's fine in case, if need more isolated scope can use url.openconnection(proxy).

http://download.oracle.com/javase/1.5.0/docs/api/java/net/url.html#openconnection%28java.net.proxy%29


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -