Поскольку Microsoft удаляет IE в новейшей версии Windows , доступ к веб-сайту возможен только в режиме совместимости (IE) в Edge.
Вот мой код:
Код: Выделить всё
var options = new InternetExplorerOptions
{
IgnoreZoomLevel = true,
IntroduceInstabilityByIgnoringProtectedModeSettings = true,
EnsureCleanSession = true,
PageLoadStrategy = PageLoadStrategy.Normal
};
IWebDriver driver = new InternetExplorerDriver($@"{AppDomain.CurrentDomain.BaseDirectory}\IEDriverServer.exe", options);
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(60);
driver.Navigate().GoToUrl("http://cced.com/cced.aspx");
Debug.WriteLine(driver. Title);
Однако даже я добавляю точку останова к строке Debug.WriteLine(driver. Title); он никогда не запускается.
Через 1 минуту он сообщает об ошибке следующего вида:
Код: Выделить всё
OpenQA.Selenium.WebDriverException
HResult=0x80131500
Message=The HTTP request to the remote WebDriver server for URL http://localhost:9324/session/700c0df3-fcf5-459e-a9d9-0487cfd42d15/url timed out after 60 seconds.
Source=WebDriver
StackTrace:
at OpenQA.Selenium.Remote.HttpCommandExecutor.d__34.MoveNext()
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.d__10.MoveNext()
at OpenQA.Selenium.WebDriver.d__63.MoveNext()
at OpenQA.Selenium.Navigator.d__7.MoveNext()
at OpenQA.Selenium.Navigator.c__DisplayClass6_0.d.MoveNext()
at OpenQA.Selenium.Navigator.GoToUrl(String url)
at ERPDownload.Form1.Form1_Load(Object sender, EventArgs e) in D:\Project\Test\Test\Form1.cs:line 28
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
Inner Exception 1:
TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
Inner Exception 2:
TimeoutException: The operation was canceled.
Inner Exception 3:
TaskCanceledException: The operation was canceled.
Inner Exception 4:
IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.
Inner Exception 5:
SocketException: The I/O operation has been aborted because of either a thread exit or an application request.
Подробнее здесь: https://stackoverflow.com/questions/790 ... ng-the-url