Gets or sets the path to the JSON configuration file (in lieu of providing any other parameters).
Namespace: OpenQA.Selenium.PhantomJSAssembly: WebDriver (in WebDriver.dll) Version: 2.35.0.0 (2.35.0.0)
public string ConfigFile { get; set; }
public string ConfigFile { get; set; }
Public Property ConfigFile As String
Get
Set
Public Property ConfigFile As String
Get
Set
public:
property String^ ConfigFile {
String^ get ();
void set (String^ value);
}
If a
PhantomJSDriverService instance is serialized to JSON, it can be saved to a
file and used as a JSON configuration source for the PhantomJS.exe process.
var configOptions = PhantomJSDriverService.CreateDefaultService()
{
CookiesFile = "cookiesFile",
DiskCache = true,
IgnoreSslErrors = true,
LoadImages = true,
LocalToRemoteUrlAccess = true,
MaxDiskCacheSize = 1000,
OutputEncoding = "abc",
Proxy = "address:999",
ProxyType = "socks5",
ScriptEncoding = "def",
SslProtocol = "sslv2",
WebSecurity = true,
};
string json = configOptions.ToJson();
File.WriteAllText(@"C:\temp\myconfig.json", json);
var driverService = PhantomJSDriver.CreateDefaultService();
driverService.ConfigFile = @"C:\temp\myconfig.json";
var driver = new PhantomJSDriver(driverService);
var configOptions = PhantomJSDriverService.CreateDefaultService()
{
CookiesFile = "cookiesFile",
DiskCache = true,
IgnoreSslErrors = true,
LoadImages = true,
LocalToRemoteUrlAccess = true,
MaxDiskCacheSize = 1000,
OutputEncoding = "abc",
Proxy = "address:999",
ProxyType = "socks5",
ScriptEncoding = "def",
SslProtocol = "sslv2",
WebSecurity = true,
};
string json = configOptions.ToJson();
File.WriteAllText(@"C:\temp\myconfig.json", json);
var driverService = PhantomJSDriver.CreateDefaultService();
driverService.ConfigFile = @"C:\temp\myconfig.json";
var driver = new PhantomJSDriver(driverService); // Launches PhantomJS.exe using JSON configuration file.