You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting the a stale element reference when I try to use the ADFSLoginAction with the code that is currently present (it is commented out in the code). Everything seems to work (the initial login page loads, code enters the username, waits for page to reload to redirected login page, enters the password and then clicks submit) but it gets a stale element reference error
public void ADFSLoginAction(LoginRedirectEventArgs args)
{
var d = args.Driver;
d.FindElement(By.Id("passwordInput")).SendKeys(args.Password.ToUnsecureString());
d.ClickWhenAvailable(By.Id("submitButton"), new TimeSpan(0, 0, 2));
d.WaitForPageToLoad();
}
I tried changing how I submit with a different line of code but it also failed with the same error
d.FindElement(By.Id("passwordInput")).SendKeys(Keys.Enter);
it ended up working if I put in the submit()
d.FindElement(By.Id("passwordInput")).Submit();
Test Name: TestOpenActiveContact
Test FullName: Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.TestOpenActiveContact
Test Source: C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Sample\OpenContact.cs : line 21
Test Outcome: Failed
Test Duration: 0:00:55.4222568
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.get_Location() at Microsoft.Dynamics365.UIAutomation.Browser.InteractiveBrowser.EventDriver_ElementValueChanged(Object sender, WebElementEventArgs e) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\InteractiveBrowser.cs:line 490 at OpenQA.Selenium.Support.Events.EventFiringWebDriver.OnElementValueChanged(WebElementEventArgs e) at OpenQA.Selenium.Support.Events.EventFiringWebDriver.EventFiringWebElement.SendKeys(String text) at Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.ADFSLoginAction(LoginRedirectEventArgs args) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Sample\OpenContact.cs:line 58 at Microsoft.Dynamics365.UIAutomation.Api.LoginPage.Login(IWebDriver driver, Uri uri, SecureString username, SecureString password, Action1 redirectAction) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Api\Pages\LoginPage.cs:line 126
at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand5.ExecuteCommand(IWebDriver driver, Object[] params) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\DelegateBrowserCommand.cs:line 134 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 167
at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute[T1,T2,T3,T4](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 60 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult,T1,T2,T3,T4](String commandName, Func6 delegate, T1 p1, T2 p2, T3 p3, T4 p4) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\BrowserPage.cs:line 102
at Microsoft.Dynamics365.UIAutomation.Api.LoginPage.Login(Uri uri, SecureString username, SecureString password, Action`1 redirectAction) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Api\Pages\LoginPage.cs:line 84
at Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.TestOpenActiveContact() in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Sample\OpenContact.cs:line 25
Result Message:
Test method Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.TestOpenActiveContact threw exception:
OpenQA.Selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: chrome=61.0.3163.100)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.15063 x86_64)
The text was updated successfully, but these errors were encountered:
Yea we see that quite a bit in our API's. Our wait extension methods are setup to ignore those exceptions types but it looks like we're not handling that in the Click extension methods. I'll add that to our tasks.
I am getting the a stale element reference when I try to use the ADFSLoginAction with the code that is currently present (it is commented out in the code). Everything seems to work (the initial login page loads, code enters the username, waits for page to reload to redirected login page, enters the password and then clicks submit) but it gets a stale element reference error
public void ADFSLoginAction(LoginRedirectEventArgs args)
{
var d = args.Driver;
d.FindElement(By.Id("passwordInput")).SendKeys(args.Password.ToUnsecureString());
d.ClickWhenAvailable(By.Id("submitButton"), new TimeSpan(0, 0, 2));
d.WaitForPageToLoad();
}
I tried changing how I submit with a different line of code but it also failed with the same error
d.FindElement(By.Id("passwordInput")).SendKeys(Keys.Enter);
it ended up working if I put in the submit()
d.FindElement(By.Id("passwordInput")).Submit();
Test Name: TestOpenActiveContact
Test FullName: Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.TestOpenActiveContact
Test Source: C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Sample\OpenContact.cs : line 21
Test Outcome: Failed
Test Duration: 0:00:55.4222568
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary
2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.get_Location() at Microsoft.Dynamics365.UIAutomation.Browser.InteractiveBrowser.EventDriver_ElementValueChanged(Object sender, WebElementEventArgs e) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\InteractiveBrowser.cs:line 490 at OpenQA.Selenium.Support.Events.EventFiringWebDriver.OnElementValueChanged(WebElementEventArgs e) at OpenQA.Selenium.Support.Events.EventFiringWebDriver.EventFiringWebElement.SendKeys(String text) at Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.ADFSLoginAction(LoginRedirectEventArgs args) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Sample\OpenContact.cs:line 58 at Microsoft.Dynamics365.UIAutomation.Api.LoginPage.Login(IWebDriver driver, Uri uri, SecureString username, SecureString password, Action
1 redirectAction) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Api\Pages\LoginPage.cs:line 126at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand
5.ExecuteCommand(IWebDriver driver, Object[] params) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\DelegateBrowserCommand.cs:line 134 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand
1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 167at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand
1.Execute[T1,T2,T3,T4](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 60 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult,T1,T2,T3,T4](String commandName, Func
6 delegate, T1 p1, T2 p2, T3 p3, T4 p4) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Browser\BrowserPage.cs:line 102at Microsoft.Dynamics365.UIAutomation.Api.LoginPage.Login(Uri uri, SecureString username, SecureString password, Action`1 redirectAction) in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Api\Pages\LoginPage.cs:line 84
at Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.TestOpenActiveContact() in C:\Code\EasyRepro-master\EasyRepro-master\Microsoft.Dynamics365.UIAutomation.Sample\OpenContact.cs:line 25
Result Message:
Test method Microsoft.Dynamics365.UIAutomation.Sample.OpenContact.TestOpenActiveContact threw exception:
OpenQA.Selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: chrome=61.0.3163.100)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.15063 x86_64)
The text was updated successfully, but these errors were encountered: