I am using Selenium.WebDriver
and Selenium.Support
3.0.1 in my tests, but after update to higher version my code throws error.
Failing code:
// Element locating
// [FindsBy(How = How.ClassName, Using = "dot")]
// private IList<IWebElement> gameDots { get; set; }
for (int i = 0; i < levelIndicators.Count; i++)
{
Browser.Action.ClickAndHold(gameDots[0]);
foreach (IWebElement gameDot in gameDots)
{
Browser.Action.MoveToElement(gameDot);
}
Browser.Action.MoveToElement(gameDots[0])
.Build()
.Perform();
}
Browser class:
public static Actions Action { get; set; }
public static IWebDriver Driver { get; set; }
static Browser()
{
Action = new Actions(Driver);
}
After update to any newer version of Selenium I am getting StaleElementReferenceException
on the line with Perform()
method. After downgrade to 3.0.1 it's working again.
OpenQA.Selenium.StaleElementReferenceException : stale element reference: element is not attached to the page document (Session info: chrome=58.0.3029.110) (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.15063 x86_64)
If i try to interact with gameDot[0]
element without doing any Actions
everything is working as intended.