I have selenium Testcase to validate contents of 2 web pages. The issue, I am facing is I am not able to get anything from .getText().

I’m using below code.

driver1.get(“https://some url”);
String b = driver1.findElement(By.className(“supArticleContent”)).getText();
WebDriver driver2 = new ChromeDriver();
driver2.get(“https://some other url
String a = driver2.findElement(By.className(“supArticleContent”)).getText();
System.out.println(“ content is”+a);

if (a.equals(b)) {
System.out.println(“TC PASSED”);

}
else{
System.out.println(“TC FAILED”);
}



Source link https://sqa.stackexchange.com/questions/34998/-to-get-text-of-an-element

LEAVE A REPLY

Please enter your comment!
Please enter your name here