selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Using Page Object, cannot work on the IWebElements loaded on the page

Open sam22blr opened this issue 10 years ago • 9 comments

When debugged the objects show a value as "{System.Runtime.Remoting.Proxies.__TransparentProxy} System.Collections.Generic.IList<OpenQA.Selenium.IWebElement> {System.Runtime.Remoting.Proxies.__TransparentProxy}"

For example the element is, [FindsByAttribute(How = How.TagName, Using = "label")] private IList SelectRole;

sam22blr avatar Jan 20 '16 20:01 sam22blr

Duplicate of #1114

jimevans avatar Jan 20 '16 20:01 jimevans

@jimevans, how to fix the existing page classes (there are many), can you give me some example code to show?

sam22blr avatar Jan 20 '16 22:01 sam22blr

@jimevans , Can you give an example on how to workaround this issue?

sam22blr avatar Jan 27 '16 20:01 sam22blr

There is no workaround. You could implement your own classes to do so, one class implement the IPageObjectMemberDecorator interface, and your own proxy objects that would be created that don't use the .NET RealProxy. Or you could petition Microsoft to allow TransparentProxy object to evaluate their properties when using Intellisense in Visual Studio.

jimevans avatar Jan 27 '16 21:01 jimevans

Thanks @jimevans. I would really appreciate if you can give me some example code on how to implement using IPageObjectMemberDecorator, google yields about 10 results without any example code?

sam22blr avatar Jan 27 '16 22:01 sam22blr

How about the code in the .NET bindings itself?

jimevans avatar Jan 27 '16 23:01 jimevans

@jimevans not helpful, do you mind giving some real example code?

sam22blr avatar Jan 29 '16 01:01 sam22blr

I'm sorry that's not helpful. As far as I know, that's the only implementation in existence. I know of no other samples of how to do this, and no, I do not have the time to create an example as I'm struggling with a pretty nasty bout of influenza at the moment.

jimevans avatar Jan 29 '16 01:01 jimevans

@jimevans, hope u feel better soon!

sam22blr avatar Jan 29 '16 01:01 sam22blr