使用Python自动填写Web浏览器表单 [英] Automatizing web browser form filling in Python

查看:162
本文介绍了使用Python自动填写Web浏览器表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.我是一个尝试学习Python的初学者,对于我的第一个项目我想编写一个脚本,该脚本将自动为我填写调查问卷.我对编码很熟悉,并且为解决这个问题,我编写了大部分代码.我正在努力写的是一种方法,它将按问题#1中的按钮#1,或按任何给定的按钮.我意识到自己可以做到这一点的一种方式,也许就是编写脚本以按tab->上->下->标签->向上->按回答所有问题的顺序排列.

Hi. I am a beginner trying to learn Python, and for one of my first projects I want to write a script that will fill out a survey automatically for me. I am familiar with coding, and I have most of the code written to solve this problem. What I am struggling is to write a method that will hit button #1 in question #1, or that will push any given button. One way I've realized I can do this, is perhaps by writing a script to press tab-> up-> down-> tab-> up -> down in the order needed to answer all of the questions.

这是调查表的图像(为清晰起见,禁用了CSS). http://i.imgur.com/Tn94KFA.jpg

Here is an image of what the survey looks like (CSS was disable for clarity). http://i.imgur.com/Tn94KFA.jpg

编写单选按钮的方法是什么?

What is one way to go about writing a method to push a radio button?

[免责声明]:我已经检查了以下问题,但是在我目前的情况下,这些问题对我没有用:

[Disclaimer]: I have checked out the following questions but they were of no use to me in my current situation:

  • fill out a webform that uses javascript with python (question was framed very strangely and was about Javascript forums, which I don't understand how it is relevant/ I didn't understand it, and nobody answered the question).
  • Script to take web survey for me (answers were only about Java, however something like this tool called HtmlUnit seems cool, if there were a comparable library in Python).
  • How to fill out form data on a website (question is about Java).

推荐答案

有一些Python库和工具可以自动执行浏览器操作.StackOverflow.com并不是向此类工具寻求建议的地方,因此主持人将结束该问题(因此,SO通常是针对特定问题寻求帮助,而不是寻求广泛的帮助和辅导要求).但是,这是您的一些起点

There are Python libraries and tools for automatizing browser actions. StackOverflow.com is not a place to ask for an recommendation for such a tool and thus moderators will close this question (SO is usually asking a help for particular problem, not for broad help and tutoriing requests). However here are some starting points for you

机械化-用于状态编程Web浏览的Python库

Selenium自动化框架Python绑定-使用完整安装浏览器

Selenium automizing framework Python bindings - using full installed browser

无头网页浏览列表-包括Python版本

Scrapy-Python中的网络内容抓取框架

有关安装Python软件包的信息,请参阅官方软件包安装指南.

这篇关于使用Python自动填写Web浏览器表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆