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); } } }
source share