使用Python自动填写Web浏览器表单 [英] Automatizing web browser form filling in Python
问题描述
嗨.我是一个尝试学习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:
- 填写将javascript与python结合使用的网络表单(问题的框架非常奇怪,是关于Javascript论坛的,我不了解它的相关性/我不理解,没有人回答这个问题.)
- 为我进行网络调查的脚本(答案仅为有关Java的信息,但是如果Python中有类似的库,类似这样的称为HtmlUnit工具的工具似乎很酷./li>
- 如何在网站上填写表单数据(有关Java的问题).
- 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
Selenium自动化框架Python绑定-使用完整安装浏览器
Selenium automizing framework Python bindings - using full installed browser
有关安装Python软件包的信息,请参阅官方软件包安装指南.
这篇关于使用Python自动填写Web浏览器表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!