question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Appium ignores iframe context when getting page source (iOS)

See original GitHub issue

When the driver is switched to the context of an iframe and you attempt to get the page source, you’ll get the source for the parent page instead of the iframe. For example assume you have the following webpages:

index.html

<html>
<head>
<title>PARENT PAGE</title>
</head>
<body>
<div>PARENT PAGE DIV</div>
<iframe src="frame.html" id="myFrame"></iframe>
</body>
</html>

frame.html

<html>
<head>
<title>IFRAME PAGE</title>
</head>
<body>
<div id='iframeDiv'>IFRAME PAGE DIV</div>
</body>
</html>

And you execute the following driver commands (showing python here but I’ve seen this via java bindings as well):

driver = webdriver.Remote( command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities={'browserName': 'Safari', 'deviceName': 'iPhone 5s', 'platformVersion': '8.1', 'platformName': 'iOS'})
driver.get('http://localhost:8000/index.html')
driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
print driver.page_source

The page source printed there will be from index.html instead of frame.html

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
imurchiecommented, Oct 25, 2017

This should be fixed in the latest beta version of Appium (and will be in 1.7.2)

0reactions
lock[bot]commented, Apr 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to manipulate click in IFrame using Android WebDriver
It work fine on an iOS simulator, but on the Android it does nothing. The test continue to run, but not action is...
Read more >
Use Selenium wait for page to load with Python [Tutorial]
Deep dive into this Python Selenium wait tutorial and find the answer to the need for usage of Selenium wait for the page...
Read more >
AppiumLibrary - GitHub Pages
AppiumLibrary is a Mobile App testing library for Robot Framework. Locating or specifying elements. All keywords in AppiumLibrary that need ...
Read more >
Cross platform testing example for Android and iOS using ...
In that case, yes there is. When you are using appium, you normally operate in the native context. But if your app contains...
Read more >
WebDriver - CodeceptJS
checkOption. Selects a checkbox or radio button. Element is located by label or name or CSS or XPath. The second parameter is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found