How to get text here? | Selenium Forum
M
Posted on 28/11/2015
When I run this code, I am unable to fetch "You logged into a secure area!" message from the web -
***************************************************************************
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Herokuapp16_ForgotPassword_ND {
public static void main(String[] args) {
WebDriver d = new FirefoxDriver();
d.get("http://the-internet.herokuapp.com/");
d.findElement(By.linkText("Form Authentication")).click();
String username = "tomsmith";
String password = "SuperSecretPassword!";
d.findElement(By.id("username")).sendKeys(username);
d.findElement(By.id("password")).sendKeys(password);
d.findElement(By.id("password")).submit();
System.out.println(d.getTitle());
[b:3a3cbg17][i:3a3cbg17]System.out.println(d.findElement(By.id("flash")).getText()); // Here is the issue.[/i:3a3cbg17][/b:3a3cbg17]
System.out.println(d.findElement(By.className("example")).getText());
d.findElement(By.cssSelector("a[href*='logout']")).click();
}
}
*****************************************************************************************
Please provide me the solution - how to get the "You logged into a secure area!" text from the webpage. Thank you in Advance.

M
Replied on 28/11/2015

Please ignore.

Actaully..the results were hidden in my eclipse console.