Note that I am a beginner and this is my first question on this site... so apologies in advance if this is awkwradly formulated.
I am coding in C# with Selenium with IE 11 webDriver.
I have a problem where I always get an exception on page load on multiple pages, including google home page (even when waiting 2 whole minutes).
What I tried to solve these errors:
- Changed PageLoadStrategy to "Eager". The page seems to load, but I still get exceptions on page load because the delay is too long.
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium;
InternetExplorerOptions IEoptions = new InternetExplorerOptions();
IEoptions.PageLoadStrategy = PageLoadStrategy.Eager;
webdriver = new InternetExplorerDriver(IEoptions);
webdriver.Navigate().GoToUrl("http://google.ca");
//This Line returns the error
- Changed the PageLoadStrategy to "None". This makes it possible to go to the next command in thread, but the webdriver does not seem to be able to access anything in the DOM. No matter what I try, I always get a webdriver exception "With a null response". I even tried seperating the code for PageLoad from the code for "FindElement" in 2 different buttons to make sure I can give sufficient time for the page to load... still getting the same exception.
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium;
private void LoadPage()
{
InternetExplorerOptions IEoptions = new InternetExplorerOptions();
IEoptions.PageLoadStrategy = PageLoadStrategy.None;
webdriver = new InternetExplorerDriver(IEoptions);
webdriver.Navigate().GoToUrl("http://google.ca");
}
private void GetElementPosition()
{
debug.print(webdriver.FindElement(By.Id("gsr")).Location.ToString());
//this line returns the error
}
Selenium version : 4.0.0
IEwebdriver version : 3.150.1.1