使用python选择动态填充的下拉列表
我正在使用 mechanize 在网站上填写表单,现在我遇到了动态填充的问题依赖于先前选择的下拉列表。我的表单中有四个动态填充的下拉列表,然后用户可以提交表单。
下拉菜单是:
Continent
-- Country #depends on continent
-- state #depends on Country
--city #depends on state
如何使用 python 从这些下拉菜单中选择值?
I'm using mechanize to fill form on a website and now I run into a problem with dynamically-filled drop-down lists that are dependent on a previous selection.I have four drop-downs in a form which are dynamically populated and then user can submit the form.
Drop-down are :
Continent
-- Country #depends on continent
-- state #depends on Country
--city #depends on state
How can I select values from these drop-downs using python?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

如果值是动态填充的,则无法执行此操作,因为 mechanize 不会负责运行 javascript 代码,因为在 Web 浏览器中显示页面时会发生这种情况。
您有一些替代方案:
If values are dynamically filled, you can't do that since mechanize won't take care of runnig the javascript code as it will happen when displaying the page in a web browser.
You have some alternatives: