我试图让IE在通过Selenium网格初始化远程驱动程序时启动每个会话。此
SqlCommand cmd = new SqlCommand(@"OPEN SYMMETRIC KEY KeyCodesKey DECRYPTION BY CERTIFICATE KeyCodes;
insert into keyfile(encrypted_key1, encrypted_key2, startingkeydate) values (EncryptByKey(Key_GUID('KeyCodesKey'),"+key1.ToString()+@"), EncryptByKey(Key_GUID('KeyCodesKey'), "+key2.ToString()+@"), CURRENT_TIMESTAMP)", cx);
cx.Open();
int success = cmd.ExecuteNonQuery();
cx.Close()
无效,IE正在使用上一次测试中的cookie启动每个新测试,这会导致问题。我正在尝试实现这个
DesiredCapabilities caps = null;
caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
WebDriver driver = new RemoteWebDriver(new URL("http://10.10.22.126:5555/wd/hub"), caps);
如here所述,但我无法弄清楚如何将其用作远程驱动程序而非本地驱动程序。谢谢!
答案 0 :(得分:2)
您可以通过以下方式将选项设置为功能:
InternetExplorerOptions ieOptions = new InternetExplorerOptions()
.destructivelyEnsureCleanSession();
capabilities.setCapability("se:ieOptions", ieOptions);
InternetExplorerOptions
类将此功能的常量定义为:
private final static String IE_OPTIONS = "se:ieOptions";