I've been developing automation using Selenium and InternetExplorerDriver for a while. I want to move to Coypu and I'm trying to convert my code. In Selenium I would specify:
InternetExplorerOptions customProfile = new InternetExplorerOptions()
{
EnsureCleanSession = true,
EnableNativeEvents = false,
IgnoreZoomLevel = true,
IntroduceInstabilityByIgnoringProtectedModeSettings = true,
RequireWindowFocus = false,
EnablePersistentHover = false,
AcceptInsecureCertificates = true,
};
InternetExplorerDriver customDriver = new InternetExplorerDriver(customProfile);
Is there any way to use these settings with Coypu?
When I try to pass in the customDriver in the code sample above by doing:
browserSession = new BrowserSession(session, customDriver);
it complains that "Cannot convert from 'OpenQA.Selenium.IE.InternetExplorerDriver' to 'Coypu.Driver'
Is there some way to make the BrowserSession take the InternetExplorerDriver as a parameter? Or is there some way to specify the settings in the customProfile in the Coypu version of the SeleniumWebDriver?
You could create your own subclass of Coypu.Drivers.Selenium.SeleniumWebDriver
. SeleniumWebDriver
does have a protected constructor, taking an OpenQA.Selenium.IWebDriver
as first argument.
Using the snippets you've provided, this would lead to the following code:
public class MySeleniumWebDriver : SeleniumWebDriver
{
public MySeleniumWebDriver(IWebDriver webDriver, Browser browser)
: base(webDriver, browser)
{
}
}
var internetExplorerOptions = new InternetExplorerOptions()
{
EnsureCleanSession = true,
EnableNativeEvents = false,
IgnoreZoomLevel = true,
IntroduceInstabilityByIgnoringProtectedModeSettings = true,
RequireWindowFocus = false,
EnablePersistentHover = false,
AcceptInsecureCertificates = true,
};
var internetExplorerDriver = new InternetExplorerDriver(internetExplorerOptions);
var myDriver = new MySeleniumWebDriver(internetExplorerDriver, Browser.InternetExplorer);
var browserSession = new BrowserSession(session, myDriver);
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.