Reputation: 3
I have a problem with selenium 3.13.0 and chrome version 79.0.3945.130 and java. I wrote this code for testing a web page that has to switch between 2 windows. when I start running this script everything is OK, but when the driver switches to the new window, It seems no longer available! And after a long time, I got this error. Does anyone know where the problem is?
(I'm sure the control of the program will come out of the loop and switch to the new window but it seems to the driver will be lost after leaving the loop. )
some functions like driver.quit() or driver.getWindowHandles() worked after exiting the loop but some others like driver.getPageSource() or driver.manage().window().maximize() are not working and cause this Error.
Here's my sample code:
public class myClassFirst {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","Driver_Path");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize(); //it works correctly
driver.get("Web_page_Url");
Thread.sleep(15000); //to load page
System.out.println("finish waiting ...");
/*
some script here
*/
// go to appropriate frame
driver.switchTo().defaultContent();
driver.switchTo().frame("Faci3");
driver.switchTo().frame(driver.findElement(By.name("Commander")));
Set<String> s = driver.getWindowHandles();
System.out.println(s); //print windowID of current window(1)
//select button element
WebElement prepareToPrint = driver.findElement(By.id("PreparePrint"));
prepareToPrint.click();
Thread.sleep(5000); //to load new window(2)
String sThis = driver.getWindowHandle(); //get windowID of current window(1)
for (String winId:driver.getWindowHandles()) {
if (!winId.equals(sThis)) {
driver.switchTo().window(winId); //switch to new window(2)
System.out.println(winId); //print windowID of new window(2)
break;
}
}
System.out.println("exit from the loop");
driver.manage().window().maximize(); //From here does not work anymore(real line 92)
Actions builder = new Actions(driver);
builder.contextClick().perform();
System.out.println("End = Finish");
driver.quit();
}
}
and this is the output:
finish waiting ...
[CDwindow-9B003436EA7F9E41C56694893D686231]
CDwindow-7205BC1AD0022BD28BFD18FCD4FA379B
exit from the loop
[1579772104.277][SEVERE]: Timed out receiving message from renderer: 300.000
[1579772104.280][SEVERE]: Timed out receiving message from renderer: -0.003
Exception in thread "main" org.openqa.selenium.TimeoutException: timeout
(Session info: chrome=79.0.3945.130)
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:14.902Z'
System info: host: 'DESKTOP-BT6SU1U', ip: '192.168.67.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.130, chrome: {chromedriverVersion: 79.0.3945.36 (3582db32b3389..., userDataDir: C:\Users\Sadell\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:61628}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 5b36cc7b69534ede85d7c957306c2626
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:614)
at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:638)
at org.openqa.selenium.interactions.Actions.perform(Actions.java:594)
at myClassFirst.main(myClassFirst.java:92)
Process finished with exit code 1
Upvotes: 0
Views: 2831
Reputation: 139
Selenium WebDriver by default waits until the page is fully loaded. However, you can tell it not to, or to employ another PageLoadStrategy.
The following should help you.
ChromeOptions options = new ChromeOptions();
options.setPageLoadStrategy(PageLoadStrategy.NONE);
This post here helped me out when I was struggling with the very same issue using EdgeDriver. https://www.skptricks.com/2018/08/timed-out-receiving-message-from-renderer-selenium.html
Upvotes: 1
Reputation: 3
Dears
in this problem, I changed my web driver from chrome to firefox and It was temporarily resolved. I hope this helps you, too.
Upvotes: 0
Reputation: 193058
This error message...
[1579772104.277][SEVERE]: Timed out receiving message from renderer: 300.000
[1579772104.280][SEVERE]: Timed out receiving message from renderer: -0.003
Exception in thread "main" org.openqa.selenium.TimeoutException: timeout
(Session info: chrome=79.0.3945.130)
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:14.902Z'
.
.
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.130, chrome: {chromedriverVersion: 79.0.3945.36 (3582db32b3389..., userDataDir: C:\Users\Sadell\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:61628}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
...implies that the ChromeDriver was unable to switch to the new TAB.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
So there is a clear mismatch between the Selenium Client v3.13.0 , ChromeDriver v79.0 and the Chrome Browser v79.0
Ensure that:
Upvotes: 0