2

I am trying to run few test on Mobile Emulators (Safari Browser) and stuck at a problem. Where after switching to an Iframe I am not able to do any action.

There is already a closed issue for that, however I didn't find any solution after going though this thread.

https://github.com/appium/appium/issues/5832

Code which is causing issue

 public PaymentPage fillCreditCardInformation(String cardNumber, String expiryDate, String cvv, String postal ){
        switchToPaymentFrame();
        WebElement cardNumberEditbox = driver.findElement(By.name("cardnumber"));
}

private void switchToPaymentFrame() {
    WebElement frame = driver.findElement(By.name("__privateStripeFrame3"));
    driver.switchTo().frame(frame);
}

Emulator Used: Iphone 6s, IPad Mini Webdriver Version: 3.4.0 Safari Driver: 2.48

Stacktrace:

org.openqa.selenium.WebDriverException: undefined is not an object (evaluating 'a.querySelectorAll') (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 30.48 seconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'DL0019', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-96-generic', java.version: '1.8.0_131' Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities [{noReset=true, safari=true, browserstack.tunnelIdentifier=, browserstack.asyncStop=true, language=Apache-HttpClient/4.5.3 (Java/1.8.0_131), browserstack.selenium_version=3.4.0, deviceName==iPad Retina (9.1) [556DF534-C4AE-48B6-8ED3-BAF86198074A], platform=MAC, browserstack.video.disableWaterMark=true, desired={noReset=true, browserstack.tunnelIdentifier=, browserstack.asyncStop=true, language=Apache-HttpClient/4.5.3 (Java/1.8.0_131), browserstack.selenium_version=3.4.0, deviceName==iPad Retina (9.1) [556DF534-C4AE-48B6-8ED3-BAF86198074A], platform=MAC, browserstack.video.disableWaterMark=true, acceptSslCerts=false, newCommandTimeout=300.0, browser=ipad, platformVersion=9.1, acceptSslCert=false, browserName=safari, platformName=iOS, 64bit=false, browserstack.debug=true, orientation=portrait, browserstack.ie.noFlash=false, os_version=, mobile={"browser":"tablet","version":"iPad Mini 4-9.1"}, browserstack.geckodriver=0.16.0, version=, browserstack.video=true, safariIgnoreFraudWarning=true, orig_os=macelc, realMobile=false, deviceOrientation=PORTRAIT, device=iPad Retina, proxy_type=node}, acceptSslCerts=false, newCommandTimeout=300.0, browser=ipad, platformVersion=9.1, webStorageEnabled=false, acceptSslCert=false, browserName=safari, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, 64bit=false, browserstack.debug=true, networkConnectionEnabled=false, orientation=portrait, browserstack.ie.noFlash=false, warnings={}, os_version=, mobile={"browser":"tablet","version":"iPad Mini 4-9.1"}, browserstack.geckodriver=0.16.0, databaseEnabled=false, version=, browserstack.video=true, safariIgnoreFraudWarning=true, orig_os=macelc, realMobile=false, locationContextEnabled=false, deviceOrientation=PORTRAIT, device=iPad Retina, proxy_type=node}] Session ID: 6bf643515813d0ccbe5fe75300ac2d8ea15a5960 *** Element info: {Using=name, value=cardnumber}

Gaurang Shah
  • 11,764
  • 9
  • 74
  • 137

2 Answers2

0

Can you try this:

Change:

private void switchToPaymentFrame() {
    WebElement frame = driver.findElement(By.name("__privateStripeFrame3"));
    driver.switchTo().frame(frame);
}

To:

private void switchToPaymentFrame() {
    WebDriverWait wait1 = new WebDriverWait(driver, 10);
    wait1.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.name("__privateStripeFrame3")));
}
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I don't think that's the issue as if frame is not found it will throw an error saying elementnofound. However, I tried and it's not working. – Gaurang Shah Oct 12 '17 at 15:36
0

Seems to me like a known issue. Simply doesn't work.

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7658

guy mograbi
  • 27,391
  • 16
  • 83
  • 122