Skip to content

Instantly share code, notes, and snippets.

@hdavidzhu
Created September 26, 2016 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdavidzhu/fdebfc3f0aab5eda80af8ea481c4bc3e to your computer and use it in GitHub Desktop.
Save hdavidzhu/fdebfc3f0aab5eda80af8ea481c4bc3e to your computer and use it in GitHub Desktop.
20160926-implementation.coffee
class Extension
# In this example, we have two iframes. The one built into our extension directly,
# and the one that renders our actual content.
# We would need to jump through two frames to get to our extension code, and we
# can also jump out to interact with the main webpage.
enterInnerFrame: ->
# Enter our extension-provided iframe.
@driver.wait(webdriver.until.elementLocated(css: @selectors.extensionFrame), 5000)
@extensionFrame = @driver.findElement(css: @selectors.extensionFrame)
@driver.switchTo().frame(@extensionFrame)
# Enter the iframe which hosts our actual content.
@contentFrame = @driver.findElement(css: @selectors.contentFrame)
@driver.switchTo().frame(@contentFrame)
# We can use this to jump back to our parent page. (LinkedIn, AngelList, etc.).
enterRootFrame: ->
@driver.switchTo().defaultContent()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment