Interacting with iFrames Using Splinter/Selenium [Python]

Viewed 636

note: a solution in either Selenium or API wrapper Splinter for Selenium is fine!

I have been having issues interacting with the iframes on Twitter.com using the Splinter API for Python.

For example,

with Browser('firefox', profile_preferences= proxySettings) as browser:
    #...login and do other stuff here
    browser.find_by_id('global-new-tweet-button').click()

this brings up a pop-up box to type in a tweet.

How do I interact with this new box using Splinter to: 1) fill in a message 2) click "tweet" (submit) ..programmatically of course.

I tried inspecting the element but it doesn't seem to be nested inside of an iframe however it targets an iframe. So I am not sure how to find/interact with the elements in this pop-up.

I tried manually typing in a message then clicking the tweet button programmatically:

browser.find_by_css('.btn.primary-btn.tweet-action.tweet-btn.js-tweet-btn').click()

..but I get the error:

ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
Stacktrace:
    at fxdriver.preconditions.visible (file:///var/folders/z1/8rqrglqn2dj8_yj1z2fv5j700000gn/T/tmppRsJvd/extensions/fxdriver@googlecode.com/components/command-processor.js:10092)
    at DelayedCommand.prototype.checkPreconditions_ (file:///var/folders/z1/8rqrglqn2dj8_yj1z2fv5j700000gn/T/tmppRsJvd/extensions/fxdriver@googlecode.com/components/command-processor.js:12644)
    at DelayedCommand.prototype.executeInternal_/h (file:///var/folders/z1/8rqrglqn2dj8_yj1z2fv5j700000gn/T/tmppRsJvd/extensions/fxdriver@googlecode.com/components/command-processor.js:12661)
    at DelayedCommand.prototype.executeInternal_ (file:///var/folders/z1/8rqrglqn2dj8_yj1z2fv5j700000gn/T/tmppRsJvd/extensions/fxdriver@googlecode.com/components/command-processor.js:12666)
    at DelayedCommand.prototype.execute/< (file:///var/folders/z1/8rqrglqn2dj8_yj1z2fv5j700000gn/T/tmppRsJvd/extensions/fxdriver@googlecode.com/components/command-processor.js:12608)

I strictly want to achieve my goal using Splinter so please do not offer alternatives, I know there are other ways. Thank you in advance!

1 Answers
Related