2

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>

6
  • Do you get any errors? Commented Nov 19, 2018 at 11:37
  • Update the question with some more of the outerHTML Commented Nov 19, 2018 at 11:40
  • OK.. Just added more information about outerHTML Commented Nov 19, 2018 at 11:54
  • @Guy - I don't get any errors Commented Nov 19, 2018 at 11:55
  • show it parent html, it is button? Commented Nov 19, 2018 at 12:16

2 Answers 2

1

Use

driver.FindElement(By.XPath("//span[@class='ui-button-text' and contains(.,'Export')]")).click();

(lower-case click()).

Sign up to request clarification or add additional context in comments.

1 Comment

it throws error in Visual Studio if I use lower case - "click"
0

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();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.