Using mechanicalsoup to set value of form element w/o a name

前端 未结 2 1138
刺人心
刺人心 2020-12-02 00:47

I have searched through all mechanicalsoup & beautifulsoup documentation but can\'t figure out how to set the value of a form element using \'id\' (because it doesn\'t h

2条回答
  •  难免孤独
    2020-12-02 01:05

    Without a name attribute, the input will be quite useless when submitting the form, since the form data will be computed based on this name attribute. Most likely this input will be used by JavaScript, not by form submission, and MechanicalSoup won't help you with JavaScript. See:

    https://mechanicalsoup.readthedocs.io/en/stable/faq.html#form-submission-has-no-effect-or-fails

    In short: you probably want to use Selenium instead.

提交回复
热议问题