0
以前は、ドライバを別のユーザーとして実行するために、次のコードを使用していました。 DesiredCapabilities is obsolete
と私はこの作業を保つために何をすべきかわからない: DesiredCapabilitiesは廃止されました
public static IWebDriver RunIEAsDifferentUser(string User,string Password)
{
var capabilitiesInternet = DesiredCapabilities.InternetExplorer();
capabilitiesInternet.SetCapability("ignoreProtectedModeSettings", true);
capabilitiesInternet.SetCapability("EnsureCleanSession ", true);
RunAs("C:\\Exlporer/IEDriverServer.exe", User, Password);
_webdriverIE = new RemoteWebDriver(new Uri("http://localhost:5555/"), capabilitiesInternet, TimeSpan.FromSeconds(300));
return _webdriverIE;
}
public static void RunAs(string path, string username, string password)
{
ProcessStartInfo myProcess = new ProcessStartInfo(path);
myProcess.UserName = username;
myProcess.Password = MakeSecureString(password);
myProcess.UseShellExecute = false;
myProcess.LoadUserProfile = true;
myProcess.Verb = "runas";
myProcess.Domain = "DOM001";
Process.Start(myProcess);
}
public static SecureString MakeSecureString(string text)
{
SecureString secure = new SecureString();
foreach (char c in text)
{
secure.AppendChar(c);
}
return secure;
}
事
は、私は警告を取得していますということです。問題のある行は:_webdriverIE = new RemoteWebDriver(new Uri("http://localhost:5555/"), capabilitiesInternet, TimeSpan.FromSeconds(300));
InternetExplorerOptions caps = new InternetExplorerOptions();
に変更しようとしました。 残念ながら、RemoteWebDriver
は現在Icapabilities
しか受け付けていません。
ちょっと感謝しています。 :-) –