使用Python与网页交互 [英] Using Python To Interact with Webpages

查看:468
本文介绍了使用Python与网页交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前的工作,我们有一个基于Web的商业智能工具在那里我每天早晨都从系统中创建的数据提取,并将其粘贴到PowerPoint presentation。我想它的重复和耗时的自动化这个(我们也有过一些裁员,我被分配了分析师的工作,所以我也想试试下午10点前回家:))。产生这些报告的瓶颈正在运行他们的网站上,然后将结果导出到Excel本手册过程可能需要10分钟什么的等待一个小时。

In my current job we have a web based Business intelligence tool where every morning i have to create data extracts from the system and paste them into a PowerPoint presentation. I wish to automate this as its repetitive and time consuming (we have also had several redundancies and i have been allocated the analysts work so i also want to try get home before 10pm :)). The bottle neck for generating these reports is running them on the website and then exporting the results to excel as this manual process can take anything from 10 minutes to an hour of waiting.

我想创建一个脚本,将打开网页,进行的选择中包含这些信息的位置,产品等,以及日期选择,preSS列表框的一次报告生成然后应用按钮导出。当没有人在办公室这样的文件都准备就绪的时候我进来的分析,而不是只生成报告,这期间发生

I would like to create a script that will open up the web page, make the selections in listboxes containing such information as location product etc as well as a date chooser, press an apply button once the report has generated then export it. This would happen during the period when no one is in the office so the files would be ready when i come in to analysis as opposed to just generating the reports

第二个较小的问题,是否有一个快速的方法来确定使用Firefox或IE浏览器的列表框,使他们能够在code中引用?

A second smaller question, Is there a quick way to identify the listboxes using firefox or IE explorer so that they can be referenced in the code?

这是可能在Python?
我们的IT部门也相当严格例如,我无法安装新的软件,但可以为Python的安装库

Is this possible in Python? Our IT department are also quite strict so for example i can not install new software but can install libraries for Python

任何人都可以点我在样品code的特别引用列表框或日期对象的方向?

Could anyone point me in the direction of sample code particularly referencing listboxes or date objects?

非常感谢您的宝贵时间。

Thank you very much for your time

推荐答案

这一切都可以通过使用硒做自动化[1]。如果您知道列表框类的名称/ ID等,硒可以让你发送点击事件到浏览器选中/取消选中列表框。读了[2]填充用Selenium HTML表单。您可以在下面的文档链接相关code。

All this can be done automated using selenium[1] . If you know the class name/id etc for the listboxes, selenium allows you to send click events to the browser for checking/unchecking listboxes. Read up [2] on filling HTML forms using selenium. You can find the relevant code in the documentation links below.

[1] http://selenium-python.readthedocs.org/

[2] http://selenium-python.readthedocs.org/en/latest/navigating.html#filling-in-forms

这篇关于使用Python与网页交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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