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 (
...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>]
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)
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').send_keys *** AttributeError: 'WebDriverElement' object has no attribute 'send_keys'
With that said, some questions:
send_keysactually 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?
If not, what else can I do? (requiring js, maybe?)