Getting java.lang.IllegalMonitorStateException while using the method wait. please let me know why?


I have written a small script where I am using the wait method. I am getting the below error. Please help me in solving this.



at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Unknown Source)
at automationFramework.TC.main(


My Scirpt:

package automationFramework;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
//private static final By Email = null;
public abstract class TC implements WebDriver {

public static void main(String[] args) throws InterruptedException {
String exePath = “C:\\Users\\Pratilipi\\Downloads\\chromedriver_win32\\chromedriver.exe”;
System.setProperty(“”, exePath);
WebDriver driver = new ChromeDriver();
String orgurl = “”;
// driver.switchTo().frame(“UWPIFrame”);
// driver.wait(5);
String titlename = driver.getTitle();
int len=titlename.length();
String url = driver.getCurrentUrl();
System.out.println(“Page name is “+titlename);
System.out.println(“Page titile length is “+len);
System.out.println(“Page original url is “+orgurl);
System.out.println(“Page url is “+url);
if (orgurl.equals(url))
System.out.println(“Correct page opened”);
System.out.println(“Not Correct”);
// By ele = Email;
driver.findElement(“Email or Phone”)).sendKeys(“<username entered>”);
// driver.navigate().to(“”);

// driver.quit();


Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.