Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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");
like image 326
Nihir Kumar Avatar asked Dec 15 '22 00:12

Nihir Kumar


1 Answers

You should be using:

driver.switchTo().window(currentWindowHandle);
like image 102
Richard Avatar answered Dec 18 '22 10:12

Richard