问题描述:

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".

相关阅读:
Top