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

Deadly 提交于 2019-11-28 14:22:25

After more research, I learned I should be using Selenium for this case (not mechanicalsoup). I used this guide which did exactly what I needed on the first try.

http://stanford.edu/~mgorkove/cgi-bin/rpython_tutorials/Scraping_a_Webpage_Rendered_by_Javascript_Using_Python.php

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!