Comments (6)
I think this issue is similar to mine. I have a site which reports a "blank field" when inspecting the form (ie. <RoboForm =, password=,...). The first "key" in the form is supposed to be "user". When using mechanize I can add the form manually but I don't know how to do it here. Any help would be appreciated.. :)
from robobrowser.
Just added this in c96e4fb. You can now add a form to a field like this:
new_field = Input('<input name="foo" value="bar" />')
form.add_field(new_field)
from robobrowser.
I've just tested your changes and it seems to work!
But i have another issue related to JS and forms:
The form i try to use has an checkbox input without an value set. When checked i see that the input gets the value "on" when submitted using a browser, but i'm not able to set this value with robobrowser.
When i try to set the value like so, i get a value [None] as result:
upload_form["check"].value = [upload_form["check"].labels[0]]
I've also tried to set it simply to True but that results in an ValueError.
Any suggestions?
from robobrowser.
@Bouni Would you mind pasting the html for the checkbox field(s) so I can debug this better?
from robobrowser.
Sure,
This is the Checkbox:
<label class="inline">
<input id="copyright_check" class="checkbox" type="checkbox" name="copyright_check">
I confirm that my design does not replicate, imitate or resemble copyright protected designs <a onclick="return Popup.openup(this);" href="/design-copyright-C2877">(examples here)</a>.
</label>
And this is what i see when i check the POST data with Chrome developer tools:
------WebKitFormBoundarySTOL4uSJiL8QsbJP
Content-Disposition: form-data; name="userfile"; filename="2273528_7513535_orig.ai"
Content-Type: application/illustrator
------WebKitFormBoundarySTOL4uSJiL8QsbJP
Content-Disposition: form-data; name="count_colors"
2
------WebKitFormBoundarySTOL4uSJiL8QsbJP
Content-Disposition: form-data; name="copyright_check"
on
------WebKitFormBoundarySTOL4uSJiL8QsbJP
Content-Disposition: form-data; name="designUploadToken"
8wrGnRa5bRfUvq2CVsQTRGk+X7IJd1vd7icEyVG1NsA=
------WebKitFormBoundarySTOL4uSJiL8QsbJP--
Response Headersview source
I'm not sure if on
is just the developer tools way to signal that the checkbox was checked or if its actually a string "on" which is transmitted as data. I was not able to find a javascript sequence that sets "on".
Thank you very much for your efforts!
from robobrowser.
Thanks! The issue is that the checkbox you're working with doesn't define a "value" attribute. When "value" isn't defined for a checkbox or radio button, a default of on
should be used. I hadn't implemented that behavior, which explains why you were running into the error you reported. As of e53ae57, form elements with a missing "value" attribute should behave correctly:
# your code should work
upload_form["check"].value = [upload_form["check"].labels[0]]
# as should this
upload_form["check"].value = ["on"]
I'll close this issue for now, but if you continue to have problems here, feel free to reopen.
from robobrowser.
Related Issues (20)
- cannot use
- .csv file getting record empty
- Unmaintained, dead, list of alternative projects
- Error handling detected unusual traffic
- browser cookies dont get changed HOT 1
- Import Error: HTMLParser HOT 1
- page screenshot
- Is this project abandonned ? HOT 1
- ImportError: cannot import name 'RoboBrowser' HOT 3
- Cannot set a value to non-existent attribute within a field
- Remove Checkbox in form
- Broken on Python 3.7 - access to re._pattern_type in Browser.get_link() HOT 1
- How to click a button in form HOT 2
- About retry
- Refresh page
- Inaccurate Docs
- RoboBrowser is broken with werkzeug upgrade HOT 4
- download
- pls fix the 'werkzeug' library HOT 8
- Possible to upload multiple files? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robobrowser.