Getting a transparent proxy time type in this context is not supported

I am new to selenium. At runtime (debugging) of my selenium tests (in C #), I get "getting the runtime type of a transparent proxy server in this context is not supported", and because of this, none of the web elements were found.

I used "Selenium.Support.PageObjects" and PageFactory to search and initialize web elements.

Can someone help me with this?

Below is a snippet of my code:

using OpenQA.Selenium; using OpenQA.Selenium.Support.PageObjects; namespace TestFramework { public class TestClass: TestBase { public TestClass(Driver driver): base(driver) { } [FindsBy(How = How.XPath, Using = "//div[@class='modal-footer']/button[@title='Yes']")] public IWebElement YesButton { get; set; } [FindsBy(How = How.XPath, Using = "//div[@class='modal-footer']/button[@title='No']")] public IWebElement NoButton { get; set; } public void ClickYesButton() { YesButton.Click(); } public void ClickNoButton(int timeout = ConfigMT.DefaultTimeout) { NoButton.Click(); } } } 

And the TestBase class:

 using OpenQA.Selenium; using OpenQA.Selenium.Support.PageObjects; using OpenQA.Selenium.Support.UI; namespace TestFramework { public class TestBase { protected IWebDriver Driver { get; set; } public Page(Driver driver) { this.Driver = driver; PageFactory.InitElements(this.Driver, this); } } } 
+5
source share
2 answers

According to this thread at the bottom of this answer, it looks like an error in the VS debugger.

A workaround is to go to Debug>Options>Debugging>General and check the Use the legacy C# and VB expressions evaluators

While this worked for me, you still will not be able to check the methods or properties of the element, if that is what you are trying to do, unfortunately.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/7f4e2bca-91dd-4919-8cbe-0adff2021ce8/debugging-transparent-proxy-objects-not-working-anymore-in-visual-studio- 2015? Forum = vsdebug

+4
source

The .NET PageFactory implementation was reorganized in 2.46 and now uses instances of System.Runtime.Remoting.Proxies.RealProxy to intercept method calls and populate your fields and properties marked with the appropriate attributes. Using the .NET Framework proxy provides the flexibility for other third-party projects to use the .NET PageFactory implementation and therefore will not change. It should be possible to create your own proxy solution that provides debugging properties in Visual Studio, but this will require a special solution.

0
source

All Articles