windowFocus doesn't want a windowID.
My code:
private static synchronized void captureScreenshot(ITestResult result) throws InterruptedException
{
....
....
String screenshot_title = "ScreenshotThis";
String orig_title_window = session().getTitle();
session().runScript("document.title='"+screenshot_title+"'");
//String title_window = session().getTitle();
Thread.sleep(500);
session().selectWindow(screenshot_title);
Thread.sleep(500);
session().windowFocus();
Thread.sleep(500);
session().windowMaximize();
Thread.sleep(500);
session().captureScreenshot(filePath);
Thread.sleep(500);
session().runScript("document.title='"+orig_title_window+"'");
Reporter.setCurrentTestResult(null);
}
With this 'synchronized' I open in parallel four pages selenium test, when happens the error, I want selectWindow with error, windowFocus with error, windowMaximize with error and captureScreenshot.
Close it and take a new screenshot from another window with error.