【发布时间】:2017-10-11 09:19:24
【问题描述】:
我使用带有 PageFactory 的页面对象模型模式来初始化 IWebElement 属性/字段。我的问题是我希望派生类使用不同的 [FindsBy] 属性覆盖 IWebElement。我的基类:
public class ConfigurationMenuPage : PageInfo, IConfigurationMenuPage
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[FindsBy(How = How.Id, Using = "ctl00_contents_ctl27")]
protected virtual IWebElement _campaignsConfigLink { get; set; }
还有我的派生类:
public class ConfigurationMenuPage21 : ConfigurationMenuPage
{
[FindsBy(How = How.Id, Using = "otherId")]
protected sealed override IWebElement _campaignsConfigLink { get; set; }
问题在于_campaignsConfigLink 属性使用基本属性初始化(id 为“ctl00_contents_ctl27”),而不是覆盖了一个(id 为 otherId)。如何强制覆盖的属性使用其 FindsBy 属性进行初始化?
问候,
Cybul26
【问题讨论】:
标签: c# selenium attributes overriding