1
我以不同的用戶身份運行IEDriverServer。打開IE瀏覽器並「連接」到現有的IEDriverServer
RunAs("C:\\Exlporer/IEDriverServer.exe", "User","Password");
_webdriverIE = new InternetExplorerDriver();
var CustomerPage = new CRMLogin(_webdriverIE).GoToCRMURL("http://foo.com");
public 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 SecureString MakeSecureString(string text)
{
SecureString secure = new SecureString();
foreach (char c in text)
{
secure.AppendChar(c);
}
return secure;
}
我想打開IE瀏覽器,但「連接」到我剛剛打開的現有驅動程序。
當調用到InternetExplorerDriver
,它打開驅動程序(當然)和前一個新的會話沒有任何意義的認識要素等方面..
_webdriverIE = new InternetExplorerDriver();
我可以在瀏覽器連接到現有InternetExplorerDriver
?