Giter VIP home page Giter VIP logo

Comments (6)

zunkzunk avatar zunkzunk commented on July 4, 2024

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.

jmcarp avatar jmcarp commented on July 4, 2024

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.

Bouni avatar Bouni commented on July 4, 2024

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.

jmcarp avatar jmcarp commented on July 4, 2024

@Bouni Would you mind pasting the html for the checkbox field(s) so I can debug this better?

from robobrowser.

Bouni avatar Bouni commented on July 4, 2024

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.

jmcarp avatar jmcarp commented on July 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.