Python automation Summary

Source: Internet
Author: User

Web:

Python web Automation Technology

Look at my own programs. The maximum number of Web automation programs can be found. There are also a lot of online requests for such programs. In the web era, the workload of operations has moved to the web, so it is not surprising that the demand for machine substitution personnel has increased.

Undoubtedly, python is a good tool for doing this:

To sum up Python's common means of Web automation:

Based on urllib2 and urllib: The vast majority of them are in this category, such as mechanic, twill, and so on. All basic modules are urllib2, that is, wrapper. This type of encapsulation is based on the HTTP request response. I also wrote a file template named autoform, which works the same way. Google keeps

Embedded webbrowser: For example, pyqt's WebKit, pamie, and spynner (based on WebKit). I am preparing to study this category because urllib2 has limitations in processing, that is, it cannot process dynamic scripts such as Js, some operations cannot be implemented. This embedded method is similar to a com call, so it supports all browser operations and has better compatibility, but it is not as quick as urllib.

Spynner: https://github.com/kiorky/spynner/

 1 A basic example:
2
3  import spynner
4 browser = spynner.Browser()
5 browser.load("http://www.wordreference.com")
6 browser.runjs("console.log('I can run Javascript')")
7 browser.runjs("console.log('I can run jQuery: ' + jQuery('a:first').attr('href'))")
8 browser.select("#esen")
9 browser.wk_fill("input[name=enit]", "hola")
10 browser.click("input[name=b]")
11 browser.wait_page_load()
12 print browser.url, browser.html
13 browser.close()
14
15 #Sometimes you'll want to see what is going on:
16
17 browser = spynner.Browser()
18 browser.debug_level = spynner.DEBUG
19 browser.create_webview()
20 browser.show()

Web Test framwork : I have never studied selenium, for example. The mechanism should combine the above two methods. Selenium IDE can also generate code, which is a powerful Web Testing Tool.

PS:

Google will run tens of thousands of selenium test cases on testing farm every day, and now there will be more, if you want to learn selenium, you can start http://selenium.seleniumhq.org from here/

 

 

Windows:

Mostly based on Win32 modules:

Python auto http://pywinauto.googlecode.com/hg/pywinauto/docs/index.html

Watsup (http://www.tizmoi.net/watsup/intro.html)

Winguiauto (http://www.brunningonline.net/simon/blog/archives/winGuiAuto.py.html)

Excel processing: xlrd, xlwt

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.