Python: actually accessible file upload in splinter?

I have a web application that lets the user upload an XML-style file and then modify it in the browser.

I am trying to test the scenario with splinter. Provided I have the correct input (id="form-widgets-body"):

enter image description here

...I can find it no problem, as well as use attach_file with its name:

(Pdb)     brwsr.find_by_id('form-widgets-body')
[<splinter.driver.webdriver.WebDriverElement object at 0x7f2be3a32dd0>]

brwsr.attach_file('form.widgets.body', PATH_TO_FILE)

But the problem with attach_file is that it doesn't actually make the file accessible to me. Maybe it just tells the input that something has been filled in, which is nice for other kinds of tests? (e.g., you can't proceed to next screen in a financial app until you upload Document X)

I tried send_keys instead, but it didn't work as expected:

(Pdb)     brwsr.find_by_id('form-widgets-body').send_keys
*** AttributeError: 'ElementList' object has no attribute 'send_keys'
(Pdb)     brwsr.find_by_id('form-widgets-body')[0].send_keys
*** AttributeError: 'WebDriverElement' object has no attribute 'send_keys'

With that said, some questions:

  1. Would send_keys actually do what I want (i.e., an accessible file upload that's just like the real thing) ? If so, what is the right way to call it?

  2. If not, what else can I do? (requiring js, maybe?)


Aha! send_keys does indeed work; I just have to access the underlying selenium driver instead of just the splinter one:



 ? Python: actually accessible file upload in splinter?
 ? Python: actually accessible file upload in splinter?
 ? TDD for plupload with Django/Splinter
 ? Firefox + Selenium in python: How to interactively get an element html?
 ? Python Splinter clicking button CSS
 ? How to automatically handle alerts with Splinter in Python
 ? Saving an image using splinter python
 ? Interacting with iFrames Using Splinter/Selenium [Python]
 ? Python: Reproduce Splinter/ Selenium Behaviour for Testing a Website That Uses Javascript
 ? How to find an element's position using XPath?