当前位置: 动力学知识库 > 问答 > 编程问答 >

How to get FindsBy attribute value programmatically in webdriver C#

问题描述:

Let's we have the following button declared on the page:

[FindsBy(How = How.Id, Using = "btnUserApply")]

public Button ApplyButton { get; set; }

Is it possible to get programmatically the web element locator Id value? Something like this:

string id = applyButton.GetLocatorValue(How how);

Or I should use reflection?

网友答案:

Yes, it is possible:

string id = applyButton.GetAttribute("id");

You can get every attribute, just write it's name instead of "id".

分享给朋友:
您可能感兴趣的文章:
随机阅读: