I\'m trying to get a handle on the button below based on the attribute gl-command
. I\'m aware I can find the button using a Cssselector
by locator
You can also create a custom selector with a method that returns your needed By selector for easy future use like this:
public static By SelectorByAttributeValue(string p_strAttributeName, string p_strAttributeValue)
{
return (By.XPath(String.Format("//*[@{0} = '{1}']",
p_strAttributeName,
p_strAttributeValue)));
}
And use it like this:
driver.FindElement(Selectors.SelectorByAttributeValue("data-power","5"))