Skip to content

Instantly share code, notes, and snippets.

@jimevans
Last active January 15, 2019 20:46
Show Gist options
  • Select an option

  • Save jimevans/7b0a6066f7e99eeb5507f9dc17c7b304 to your computer and use it in GitHub Desktop.

Select an option

Save jimevans/7b0a6066f7e99eeb5507f9dc17c7b304 to your computer and use it in GitHub Desktop.
Firefox/Geckodriver frame navigation test
from selenium import webdriver
driver = webdriver.Firefox()
try:
driver.get('http://localhost/startPage.html')
driver.switch_to.frame(0)
element = driver.find_element_by_id('top')
element.click()
driver.get('http://localhost/frameContent.html')
finally:
driver.quit()
<html>
<head>
<title>Frame Test Frame Content Page</title>
</head>
<body>
<a href="landingPage.html" id="top" target="_top">Click to navigate</a>
</body>
</html>
<html>
<head>
<title>Frame Test Landing Page</title>
</head>
<body>
Content for landing page.
</body>
</html>
<html>
<head>
<title>Frame Test Start Page</title>
</head>
<body>
<div>Content for start page</div>
<iframe id="testFrame" src="frameContent.html"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment