Reputation: 51
Just trying below code to click Export button in and it not clicking the button
driver.FindElement(By.XPath("//span[@class='ui-button-text' and contains(.,'Export')]")).Click();
Outer HTML code
Export
<span class="ui-button-text" style="">Export</span>
Upvotes: 2
Views: 69
Reputation: 51
Resolved myself after digging into Wait methods. Below code recognizes the button.
new WebDriverWait(driver, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//span[@class='ui-button-text' and contains(.,'Export')]"))).Click();
Upvotes: 0
Reputation: 8394
Use
driver.FindElement(By.XPath("//span[@class='ui-button-text' and contains(.,'Export')]")).click();
(lower-case click()
).
Upvotes: 1