For desktop, On click on paypal btn, new window open on which user fill their crediantials and then it goes back to original page.
To handle this, i wrote following code
winHandle = driver.getWindowHandles();
console.log("no. of window "+winHandle.toArray().length); //1 for mobile
handle = winHandle.toArray()[winHandle.size() - 1];
console.log(handle);
previousHandle = winHandle.toArray()[0];
//On paypal login, a new window will open. Below code will handle the window switching. But this is not happening with mobile
driver.switchTo().window(handle);
console.log("switched to paypal window");
paypalLogin = new PayPalLoginPage(driver);
paypalLogin.proceedWithSandBoxPurchase();
//switch to origin window
driver.switchTo().window(previousHandle);
But problem with android and iphone is, on click of paypal btn no other window is open but paypal page appears.
When i try to find any element of this paypal page i get element not found exception.
Has someone faced this issue paypal login process in selenium or galen framework for mobile testing in saucelabs ? And how it solved?