user2598794
user2598794

Reputation: 727

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?

Upvotes: 1

Views: 1142

Answers (1)

kotoj
kotoj

Reputation: 779

Yes, it is possible:

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

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

Upvotes: 1

Related Questions