Reputation: 407
I have some html like this:
<a>This is the Children's Miracle Network</a>
I as expected am getting an error when I do
WebElement ele = driver.findElement(By.xpath("//a[contains(text(),'This is the Children's Miracle Network)]"));
because the apostrophe in Children's is unquoting the text. I tried using double ' (like '') and backslashing (\') but that did not work. I am not sure what to do? Any suggestions?
Upvotes: 0
Views: 97
Reputation: 32980
You can try
WebElement ele = driver.findElement(By.xpath("//a[contains(text(),\"This is the Children's Miracle Network\")]"));
Upvotes: 1