StaleElementReferenceException: Element specified by 'id' is no longer valid

112 views
Skip to first unread message

Richard

unread,
Aug 16, 2011, 5:09:24 AM8/16/11
to Selenium Users
Hi,

I'm using the 2.4.0 selenium server in hub mode with two nodes each
with 5 instances of Internet explorer (IE8 on win7) - this is all
running on the same Win7 machine

The following code throws the exception on the final call to
FindElements on the RemoteWebDriver

_driver.Navigate().GoToUrl(@"http://devrsql714/webpages/
parentview.aspx");
var wait = new WebDriverWait(_driver, new TimeSpan(0, 0,
40));
wait.Until(d =>
d.FindElement(By.ClassName("TitleAlternative")));
Console.WriteLine(string.Format("Window title: {0}",
_driver.Title));
var element = _driver.FindElementById("txtLessonID");
element.SendKeys("13814");
var button = _driver.FindElementById("btnLessonID");
button.Click();
wait = new WebDriverWait(_driver, new TimeSpan(0, 0, 40));
var link = wait.Until(d => d.Title.Contains("Lesson:
01652-06-A"));
Console.WriteLine(string.Format("Window title: {0}",
_driver.Title));
Assert.IsTrue(_driver.Title.Contains("01652"));
Console.WriteLine(string.Format("page source: {0}",
_driver.PageSource));
_driver.FindElementsByTagName("DIV");

I can see the browser load, navigate, fillin the text box and click
the button - the page refreshes the title changes - the assert passes
(this is running in MbUnit with Gallio)

but the subsequent call to _driver.FindElementsByTagName throws the
exception below - I added waits in case that was the issue and any
find elements results in the same exception

what am I doing wrong? - other properties on the driver work such as
title and page source (which has the excepted content)

any help much appreciated


Execute
OpenQA.Selenium.StaleElementReferenceException: Element specified by
'id' is no longer valid (WARNING: The server did not provide any
stacktrace information)
Build info: version: '2.4.0', revision: '13337', time: '2011-08-12
09:57:13'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1',
java.version: '1.6.0_20'
Driver info: driver.version: RemoteWebDriver
at
OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response
errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver
\Remote\RemoteWebDriver.cs:line 948
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(DriverCommand
driverCommandToExecute, Dictionary`2 parameters) in c:\Projects
\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line
805
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElements(String
mechanism, String value) in c:\Projects\WebDriver\trunk\dotnet\src
\WebDriver\Remote\RemoteWebDriver.cs:line 851
at
OpenQA.Selenium.Remote.RemoteWebDriver.FindElementsByTagName(String
tagName) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote
\RemoteWebDriver.cs:line 622
at SeleniumTests.DemoTest.AnotherTest()

Jim Evans

unread,
Aug 16, 2011, 7:04:18 AM8/16/11
to Selenium Users
It sounds a lot like the IE driver is returning the wrong error here.
I'm out of town at the moment, but I'll do what I can to look into it
upon my return.

Luke Inman-Semerau

unread,
Aug 16, 2011, 10:36:51 AM8/16/11
to seleniu...@googlegroups.com
There is a major problem in 2.4, that was discussed late yesterday in the irc channel.

Please downgrade to 2.3 or wait for 2.5

I probably woulda hit this too, but since I use maven I'm still on 2.3 :)

-Luke

> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
>

Neil H.

unread,
Aug 17, 2011, 6:12:26 PM8/17/11
to Selenium Users
Has an issue in the bug tracker already been created for this problem
in 2.4? I can't seem to find one...

On Aug 16, 7:36 am, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> There is a major problem in 2.4, that was discussed late yesterday in the irc channel.
>
> Please downgrade to 2.3 or wait for 2.5
>
> I probably woulda hit this too, but since I use maven I'm still on 2.3 :)
>
> -Luke
>

Daniel Wagner-Hall

unread,
Aug 18, 2011, 1:56:47 PM8/18/11
to Selenium Users
This has been fixed on trunk, and will be included in the 2.5 release
Reply all
Reply to author
Forward
0 new messages