How to find by XPath text that contains apostrophe (single quote) in Selenium WebDriver

Selenium WebDriver.

< 1 minute read The only reliable way of using XPath in Selenium WebDriver for text with apostrophes (single quotes) is to use double quotes for the expression of the XPath. In order to find how to use XPath to locate WebElements in Chrome browser you can check our previous article. For example, for the code below: driver.findElement(By.xpath(“//*[@text='” + text + “‘]”))… Read more »