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 :
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");
You should be using:
driver.switchTo().window(currentWindowHandle);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With