Post by leiwang on Jan 4, 2017 6:00:04 GMT
In some testing environment, Internet access is not direct, but through a Proxy server. This section is talking about HTTP proxy settings in SeleniumPlus.
There are 2 ways:
If user sets the "HTTP proxy" in both ways, "API parameters" will override those in "Global setting".
Global setting:
The HTTP proxy can be set globally in the INI configuration file.
[SAFS_SELENIUM]
;define the HTTP PROXY host name to connect Internet
GATEWAYHOST=yourGateway.net
;define the HTTP PROXY port number to connect Internet
GATEWAYPORT=80
;define the HTTP PROXY "bypass address" when connecting INTRANET
PROXY_BYPASS_ADDRESS=localhost,127.0.0.1,host.not.thru.gateway
By API parameters:
The HTTP proxy can also be set by the optional parameters of StartWebBrowser API. The optional parameters are given as pair (key, value). The keys related to "HTTP proxy" are:
Examples:
There are 2 ways:
- Global setting
- By API parameter
If user sets the "HTTP proxy" in both ways, "API parameters" will override those in "Global setting".
Global setting:
The HTTP proxy can be set globally in the INI configuration file.
[SAFS_SELENIUM]
;define the HTTP PROXY host name to connect Internet
GATEWAYHOST=yourGateway.net
;define the HTTP PROXY port number to connect Internet
GATEWAYPORT=80
;define the HTTP PROXY "bypass address" when connecting INTRANET
PROXY_BYPASS_ADDRESS=localhost,127.0.0.1,host.not.thru.gateway
By API parameters:
The HTTP proxy can also be set by the optional parameters of StartWebBrowser API. The optional parameters are given as pair (key, value). The keys related to "HTTP proxy" are:
- KEY_PROXY_SETTING: the key for proxy string; The value is colon separated string as "proxyserver:port"
- KEY_PROXY_BYPASS_ADDRESS: the key for proxy bypass address string; The value is comma separated string as "localhost,tadsrv,rnd.sas.com"
Examples:
//Start the firefox web browser with proxy server as "proxy.server" and proxy server port as "8080"
StartWebBrowser("http://www.google.com", "GoogleMain", new String[]{
SelectBrowser.BROWSER_NAME_FIREFOX,
"10",
"true",
SelectBrowser.KEY_PROXY_SETTING,
"proxy.server:8080"
});
//Start the firefox web browser with proxy server as "proxy.server" and proxy server port as "8080"
//local.site1, local.site2 will not be routed through "proxy.server"
StartWebBrowser("http://www.google.com", "GoogleMain", new String[]{
SelectBrowser.BROWSER_NAME_FIREFOX,
"10",
"true",
SelectBrowser.KEY_PROXY_SETTING,
"proxy.server:8080",
SelectBrowser.KEY_PROXY_BYPASS_ADDRESS,
"local.site1, local.site2"
});