SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.88k stars 8.22k forks source link

Properties of IWebElement are not visible in VisualStudio 2013 #1114

Closed koreyba closed 9 years ago

koreyba commented 9 years ago

use Selenium WebDriver C# and PageFactory (PageObject) pattern to create automated tests. I develop them in Visual Studio 2013.

Before the latest version of Webdriver (now I use 2.47.0) it worked well but now I face the next problem: I can not view properties of my web elements.

Here is how I create and initialize an element:

public class MyPageObj : DriverCover { public MyPageObj(IWebDriver driver) : base(driver) { //'Driver' is a EventFiringWebDriver (IWebDriver) from parent class PageFactory.InitElements(Driver, this); }

    [FindsBy(How = How.CssSelector, Using = "#internal")]
    private IWebElement _myElement;

}

When I run tests and at a breakpoint I want to watch properties of _myElement I see only non-public members: http://prntscr.com/8o075p

If I don't use PageFactory and find elements using Driver.FindElement(By.How()) method it works well.

jimevans commented 9 years ago

This is due to the refactor of the .NET bindings' PageFactory implementation to use proxy objects that descend from System.Runtime.Remoting.Proxies.RealProxy instead of hand-crafted proxy object classes. This change, introduced in commit 689276b was necessary to support Page Objects for third-party WebDriver implementations, such as Appium. It is unfortunate that this breaks dynamic debugging from within Visual Studio, but to maintain the flexibility required to support other projects outside of just WebDriver itself, there is no other reasonable alternative.