htmlelements-dotnet
htmlelements-dotnet copied to clipboard
Exception when calling FindElement on WrappedElement
I'm calling this code from a TestMethod:
class TheInternet
{
[FindsBy(How = How.LinkText, Using = "Hovers")]
private Link lnk1;
public TheInternet(IWebDriver driver)
{
HtmlElementLoader.PopulatePageObject(this, driver);
}
public void DoStuff()
{
lnk1.WrappedElement.FindElement(By.XPath("self"));
}
}
The resulting error is this:
Result StackTrace:
bij CallSite.Target(Closure , CallSite , Object , By )
bij System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
bij ActLike_IWebElement_3d48e16bd9ab45a1ba77091907bedc73.FindElement(By by)
bij HtmlElements.Tests.TestPages.TheInternet.DoStuff() in C:\Users\Frederik\Desktop\htmlelements-dotnet-master\HtmlElements-DotNet\HtmlElements-Tests\Tests\TestPages\TheInternet.cs:regel 24
bij HtmlElements.Tests.AnnotatedHtmlElementPageTest.HHEEELLLP() in C:\Users\Frederik\Desktop\htmlelements-dotnet-master\HtmlElements-DotNet\HtmlElements-Tests\Tests\AnnotatedHtmlElementPageTest.cs:regel 20
Result Message:
Test method HtmlElements.Tests.AnnotatedHtmlElementPageTest.HHEEELLLP threw exception:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Yandex.HtmlElements.Loaders.Decorators.ProxyHandlers.WebElementNamedProxyHandler contains no definition for FindElement
It looks like this port has some specifics with implementation of element proxies (since there are no default dynamic Proxy implementation in C# as in Java). I stumbled upon that when was trying to use the HtmlElement or TypifiedElement with IJavaScriptExecutor.
Otherwise I'd say that the port is good. HtmlElements in Java may now have some opponents, though in C# there aren't too many.
@artkoshelev @HardNorth I understand that this port is not supported that much, but maybe we can discuss shortly if there is a possibility to polish it a bit? I am willing to help, though would have been good to hear your input as you might know more about details.
@Exoow try doing it using the HtmlElement directly, and not its WrappedElement
@iangavr i don't have any knowledge on this implementation, but you are welcome to send your 'polishing' PR's