selenium webdriver – Getting error “Exception in thread “main” java.lang.IllegalMonitorStateException: current thread is not owner

Exception in thread “main” java.lang.IllegalMonitorStateException: current thread is not owner
at java.base/java.lang.Object.wait(Native Method)
at selenium_Java.title_comparison.main(title_comparison.java:27)

Getting the above error. I’m not pretty much sure about the reason so please help me in resolving this error. Also attaching the code snippet.

Note: Trying to implement explicit wait hence getting this error.

Help me understanding the correct way to use explicit wait in selenium enter image description hereversion 4 enter image description here

Read more here: Source link