Here is a button on the page:
<button data-purpose="add-section-btn" type="button"
class="ellipsis btn btn-default btn-block">
<span class="a3 udi udi-plus-square"></span>
<!-- react-text: 255 --> <!-- /react-text -->
<!-- react-text: 256 -->Add Section<!-- /react-text -->
</button>
When I try to find it using the following code:
var btns = _driver.FindElements(By.TagName("button"));
var sectionTitle = btns.Where(x => x.GetAttribute("data-purpose") == "add-section-btn");
It returns null.
If I try the following XPath:
var btn = _driver.FindElement(By.XPath("//button[data-purpose=\"add-section-btn\"]"));
then I get an exception.
How to find such a button?