[C#]Cant't get wrappedDriver from an element using PageFactory
See original GitHub issueWhen elements are located using PageFactory there seems to be an issue with casting element to IWrapsDriver, although it works pretty good with elements found by FindElement(s).
In my case I’m trying to get wrappedDriver inside following extension method
public static bool SelectDropdownOptionByText(this IWebElement element, string optionText)
.
Here to be more specific:
private static IWebDriver GetDriverFromElement(IWebElement element) { return ((IWrapsDriver)element).WrappedDriver; }
Error says:
Additional information: Unable to cast transparent proxy to type ‘OpenQA.Selenium.Internal.IWrapsDriver’.
BTW:Is this NOT implemented or as designed?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
[C#]Cant't get wrappedDriver from an element using ... - GitHub
When elements are located using PageFactory there seems to be an issue with casting element to IWrapsDriver, although it works pretty good ...
Read more >Getting WebDriver from IWebElement - Stack Overflow
I can't cast my element to RemoteWebElement, as I'm using PageFactory to initialize page with IWebElements and it is of type OpenQA.Selenium.
Read more >Page Object Model (POM) With Page Factory | Selenium Tutorial
First, we need to find the web elements by annotation @FindBy in page classes. Then initialize the elements using initElements() when ...
Read more >Selenium: java/CHANGELOG | Fossies
As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers.
Read more >Selenium Java Changelog - GitHub
[grid] Grid is ready when Nodes are up and have availability. ... if the default isn't there * Pass Options.ime() through to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s useful for IWebElement extension methods
E.g.
The proxy object created by the .NET
PageFactory
implementation does not proxy theIWrapsDriver
interface. It’s unclear how that interface would be useful from a page object, which should have a reference to the driver anyway.