Selenium WebDriver - how to verify multiple lines text
multiline, verify, webdriver
Solution
You can do:
webDriver.findElement(By.id("<ID of center tag>")).getText().contains("This is Login page.Please click below link to Login.Login");
Feel free to use a locator of your choice instead of By.id.
Basically getText() of any WebElement returns the textual content of the node, stripped of all the HTML tags and comments.
Problem
I have an html page with following contents: ``` <center> This is Login page. <br> Please click below link to Login. <br> <a href="xxx">Login</a> </center> ``` How can I verify all the static text above using one webdriver command? I tried these but none of it works :( ``` driver.findElement(By.xpath("//*[contains(.,'This is Login page.<br>Please click below link to Login')]")) driver.findElement(By.xpath("//*[contains(.,'This is Login page.\nPlease click below link to Login')]")) ``` Anyone know how to do it?