Reputation: 866
using selenium is easy though i need to start the driver with proper setup
so for now i just need that it will ignore zoom level
my code is :
public string path = AppDomain.CurrentDomain.BaseDirectory;
public IWebDriver WebDriver;
var ieD = Path.Combine(path, "bin");
DesiredCapabilities caps = DesiredCapabilities.InternetExplorer();
caps.SetCapability("ignoreZoomSetting", true);
now my current code is only passing the path of the driver as parameter
WebDriver = new InternetExplorerDriver(ieD);
how can i properly pass both capabilities and drivers path?
Upvotes: 4
Views: 13952
Reputation: 32885
There is a InternetExplorerOptions
class for IE options, See source, which has a method AddAdditionalCapability
. However, for your ignoreZoomSetting
, the class has already provided a property called IgnoreZoomLevel
, so you don't need to set capability.
On the other hand, InternetExplorerDriver
has a constructor for both path of IEDriver and InternetExplorerOptions. Source
public InternetExplorerDriver(string internetExplorerDriverServerDirectory, InternetExplorerOptions options)
Here's how you use it:
var options = new InternetExplorerOptions {
EnableNativeEvents = true, // just as an example, you don't need this
IgnoreZoomLevel = true
};
// alternative
// var options = new InternetExplorerOptions();
// options.IgnoreZoomLevel = true;
// alternatively, you can add it manually, make name and value are correct
options.AddAdditionalCapability("some other capability", true);
WebDriver = new InternetExplorerDriver(ieD, options);
Upvotes: 10