On 14 October 2011 12:18, Bruno Rocha <[email protected]> wrote: > do you have firebug? splinter use same selectors of css (pure DOM) >
Yes, I am using Firebug. I have tried again now and still have not got to a
working solution.
The form looks like this (screenshot attached if from the browser opened by
Splinter):
<table>
<tbody>
<tr id="wbdocuments_name__row">
<td class="w2p_fl">
<label id="wbdocuments_name__label" for="wbdocuments_name">Document name: </
label>
</td>
<td class="w2p_fw">
<input id="wbdocuments_name" class="string" type="text" value="" name="name"
>
</td>
<td class="w2p_fc"></td>
</tr>
<tr id="wbdocuments_file__row">
<td class="w2p_fl">
<label id="wbdocuments_file__label" for="wbdocuments_file">Download: </label
>
</td>
<td class="w2p_fw">
<input id="wbdocuments_file" class="upload" type="file" name="file">
</td>
<td class="w2p_fc"></td>
</tr>
<tr id="submit_record__row">
<td class="w2p_fl"></td>
<td class="w2p_fw">
<input type="submit" value="Submit">
</td>
<td class="w2p_fc"></td>
</tr>
</tbody>
</table>
I have tried
from splinter.browser import Browser
browser = Browser()
browser.visit('http://localhost:8000/init/wbank/addoc')
browser.fill('name', 'Part_A.pdf')
browser.fill('file', '/home/js/web2py/applications/akb/uploads/Part_A.pdf')
At this stage the form looks like the screenshot. You will see that the
'name' field is empty.
Then
button = browser.find_by_css('button').first
button.click()
And the opened browser was asking for an admin password and the record was
not in the table.
With mechanize I don't get further than this:
br.select_form(name = "_formname")
FormNotFoundError: no form matching name '_formname'
I don't know how to use the form_id in this case:
br.select_form(id = 'wbdocuments_name')
TypeError: select_form() got an unexpected keyword argument 'id'
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
<<attachment: Selection_005.png>>

