import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import static javax.swing.JOptionPane.showMessageDialog;
public class Runcheck{
public static void main( String[] args ) throws IOException{
try {
web1();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void web1() throws InterruptedException{
ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-allow-origins=*");
WebDriver driver = new ChromeDriver(options);
driver.get("URL");
WebElement textElement =driver.findElement(By.cssSelector("body"));
String checktext = textElement.getText().toString();
Boolean check =checktext.contains("ok");
if(check=true) {
System.out.printf(checktext);
driver.close();
}
else {
driver.close();
showMessageDialog(null, "Something's Error!!!");
Thread.sleep(3000);
System.exit(0);
}
}