简体   繁体   English

python:自动化网络任务

[英]python : automating web tasks

how can i automate web tasks with python我如何使用 python 自动化 Web 任务

what i am trying to do is..我想做的是..

make the script open a forum thread url and post the text i wrote in the script and multiply it with more urls and hopefully browsing them randomly and doing the same task使脚本打开一个论坛线程 url 并发布我在脚本中编写的文本并将其与更多 url 相乘,并希望随机浏览它们并执行相同的任务

eg例如

urllist : example.txt
goto random url
do the task
repeat

can someone give me ideas to where to start and which programs i can use to entegrate with the browser?有人可以告诉我从哪里开始以及我可以使用哪些程序与浏览器集成的想法吗?

i have basic knowledge in python i just need to know what information to learn to complete a script like this我有 python 的基本知识,我只需要知道学习什么信息来完成这样的脚本

im trying to improve myself我正在努力提高自己

The first thing that comes to mind for your goal is Selenium: http://selenium-python.readthedocs.io/getting-started.html你的目标首先想到的是硒: http : //selenium-python.readthedocs.io/getting-started.html

It can simulate human behavior (including login to site) and locate certain elements (then you can click/hover on them or download an image, for example).它可以模拟人类行为(包括登录站点)并定位某些元素(例如,您可以单击/悬停它们或下载图像)。 What's more - it can be used with PhantomJS (headless browser), so that you will not see the actual browser window.更重要的是 - 它可以与 PhantomJS(无头浏览器)一起使用,这样您就不会看到实际的浏览器窗口。 More info here: https://realpython.com/blog/python/headless-selenium-testing-with-python-and-phantomjs/更多信息: https : //realpython.com/blog/python/headless-selenium-testing-with-python-and-phantomjs/

Selenium has built-in HTML parsing tools as well, so you will not need any extra libs like Beautiful Soup for parsing. Selenium 也有内置的 HTML 解析工具,所以你不需要像 Beautiful Soup 这样的额外库来解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM