0

I am trying to locate an element, which is a textbox that contains hint text:

<textarea placeholder="What's going on?"><textarea>

Here's what I have tried, which is not working.

@FindBy(xpath="//textarea[@placeholder='What\'s going on?']")
public WebElement inputBox;
Faye
  • 39
  • 7
  • Possible duplicate of [Escape single quote in XPath with Nokogiri?](https://stackoverflow.com/questions/14822153/escape-single-quote-in-xpath-with-nokogiri) – Piotr P. Karwasz Nov 08 '19 at 17:53

2 Answers2

2

Try this instead:

@FindBy(xpath="//textarea[@placeholder=\"What's going on?\"]")

It escapes the surrounding quotes so it can handle the quote correctly.

Word Rearranger
  • 1,306
  • 1
  • 16
  • 25
0

Please try below xpath :

 //textarea[contains(@placeholder, "What's going on?")]
SeleniumUser
  • 4,065
  • 2
  • 7
  • 30