Selenium Webdriver - Chrome - Switch Window and back - Unable to receive message from renderer

16,670

Solution 1

You should be using:

driver.switchTo().window(currentWindowHandle);

Solution 2

It causes because page took long time to load , you need add additional line to your chromedriver option.

System.setProperty("webdriver.chrome.driver","E:\\selenium\\chromedriver_2.41\\chromedriver.exe");
//mention the below chrome option to solve timeout exception issue
ChromeOptions options = new ChromeOptions();
options.setPageLoadStrategy(PageLoadStrategy.NONE);
// Instantiate the chrome driver
driver = new ChromeDriver(options);

Solution 3

The problem is resolved.

The place where I was declaring currentWindowHandle was after clicking and it takes the new window as the Current Window handle.

I just moved below statement to before the new window click event.

String currentWindowHandle=driver.getWindowHandle();

Thanks all for your time and Help.

Share:
16,670

Related videos on Youtube

Nihir Kumar
Author by

Nihir Kumar

Test Engineer ... Working on Automation tests, With Webdriver. My passion is to how to make tasks simpler.

Updated on June 04, 2022

Comments

  • Nihir Kumar
    Nihir Kumar almost 2 years

    This is my first question on Stack Overflow. Thanks to all StackOverflow users who keeps technology passion ticking.

    I am testing a web application with selenium Webdriver . It is payment webpage where, after selecting Payment method as 'PayPal' it opens up a new Popup , a PayPal popup and i Switch window to Paypal , do all my necessary Transaction. And once the Transaction is successful , automatically the paypal popup is closed, and i am not able to return to my original window from where i have initiated transaction.

    I am getting following error in eclipse console:

    Starting ChromeDriver (v2.9.248315) on port 25947
    [70.164][SEVERE]: Unable to receive message from renderer
    

    The following details might help :

    • selenium Webdriver (2.28.0)
    • java - JRE7
    • Google Chrome Version - Version 33.0.1750.146
    • Test Framework - Test NG

    Here is my code :

                  // To Switch to Popup/Paypal window
    
                  String currentWindowHandle=driver.getWindowHandle();        
    
                 Set<String> openWindowsList=driver.getWindowHandles();        
                 String popUpWindowHandle=null;
                 for(String windowHandle:openWindowsList)
                 {
                 if (!windowHandle.equals(currentWindowHandle))
                 popUpWindowHandle=windowHandle;
                 }
    
                driver.switchTo().window(popUpWindowHandle);      
        // Carraying out my paypal transaction        
                driver.manage().window().maximize();
                driver.findElement(By.xpath("//*[@id='loadLogin']")).click();
    
            Thread.sleep(8000);
    
            WebElement login_email = driver.findElement(By.xpath("//*[@id='login_email']"));
            login_email.clear();
            login_email.sendKeys(Keys.BACK_SPACE);
            login_email.sendKeys("[email protected]");
    
            WebElement login_password = driver.findElement(By.xpath("//*[@id='login_password']"));
            login_password.clear();
            login_password.sendKeys("abcxyz");
          // Next Click is Final Click on PayPal                        
            driver.findElement(By.xpath("//*[@id='submitLogin']")).click();
          // Transaction is finished on PayPal side and it automatically popup is closed
          //Now i am trying to switch to my last working(original) window
            driver.switchTo().window("My Web Page Title");
    
  • Nihir Kumar
    Nihir Kumar about 10 years
    Thanks for your response. However the issue still persists. CurrentWindowHandle didn't worked. Still I am an not able to switch to my original window. Any more suggestions ? I would be glad to try