I have to find text -'To' email address is formatted incorrectly- using xpath. Below xpath is working well for me
(//*[contains(.,"'To' email address is formatted incorrectly.")])[5]
But when I put this xpath in my locator.
@FindBy(xpath="(//*[contains(.,"'To' email address is formatted incorrectly.")])[5]") public WebElement incorrectEmailFormatLabel;
I am getting warning error message in code. I know this is because of double quotes used("'To'..."), but if I change it to single quote(''To'...') I get this error message
invalid selector: Unable to locate an element with the xpath expression (//*[contains(.,''To' email address is formatted incorrectly.')])[5]
Let me know how to resolve it? I followed this post also, here xpath is not working for me.
(//*[contains(.,\" 'To' email address is formatted incorrectly.\")])[5]