Coypu attribute access - race condition

103 views
Skip to first unread message

Dominik Rauch

unread,
Nov 18, 2014, 3:43:00 AM11/18/14
to co...@googlegroups.com
In contrast to actions like FillWith or SelectOption, access to attributes (like ElementScope.Value) are not secured via the Try() method. Why so?

Unfortunately, this runs into race conditions, e.g. acessing:

scope.FindId("test").Value;

Value is (summarized) implemented as:

return this.Now().native.GetAttribute("value");

if the page changes between the call of Now() and the GetAttribute() call I get the following exception:

OpenQA.Selenium.StaleElementReferenceException : Element is no longer valid
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.GetAttribute(String attributeName)

Is it possible to provide "secure" access as well?

Best regards,
Dominik

Adrian Longley

unread,
Nov 18, 2014, 4:07:05 AM11/18/14
to co...@googlegroups.com
This does sound like it should be fixed from what you say. Could you please move this to a github issue and I'll take a look as soon as I can.

Cheers
--
You received this message because you are subscribed to the Google Groups "Coypu" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coypu+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dominik Rauch

unread,
Nov 18, 2014, 4:12:26 AM11/18/14
to co...@googlegroups.com
Done, see https://github.com/featurist/coypu/issues/117.

My guess is, that wrapping those property implementations with Try() will do the trick.

Adrian Longley

unread,
Nov 18, 2014, 4:38:59 AM11/18/14
to co...@googlegroups.com
On Tue, Nov 18, 2014 at 9:12 AM, Dominik Rauch <dominik....@gmail.com> wrote:
Done, see https://github.com/featurist/coypu/issues/117.

My guess is, that wrapping those property implementations with Try() will do the trick.

Thank you.
Reply all
Reply to author
Forward
0 new messages