Python invoke browser, implement brush Web Applet

Source: Internet
Author: User
Python opens the browser, can do a simple Brush Web page applet and other imaginative programs. But for study only, do not use illegal use.

Python's WebBrowser module supports a number of actions on the browser

There are three main ways to do this:

Webbrowser.open (URL, new=0, autoraise=true) webbrowser.open_new (URL) webbrowser.open_new_tab (URL)

The above three methods can be any one, under the python2.7 test pass, but this to test under Windows OH

We need to understand the Webbrowser.open () method:

Webbrowser.open (URL, new=0, autoraise=true)

Access the URL address in the system's default browser, if New=0,url will be in the same

Open in the browser window; if new=1, the new browser window will be opened; new=2

The new browser tab will be opened.

The Webbrowser.get () method can get the action object to the System browser.

The Webbrowser.register () method can register the browser type, while the type name that is allowed to be registered is as follows:

Type name Class name Notes ' Mozilla ' Mozilla (' Mozilla ') ' Firefox ' Mozilla (' Mozilla '   )   ' Netscape ' Mozilla (' Netscape '   Galeon ' Galeon (' Galeon ')   ' Epiphany ' Galeon (' epiphany ') ' Skipstone   ' Backgroundbrowser (' Skipstone ')   ' kfmclient ' Konqueror () (1) ' Konqueror ' Konqueror () (1) ' KFM ' Konqueror () (1) ' Mosaic ' backgroundbrowser (' mosaic ')   ' Opera ' opera ' () '   Grail ' grail ()   ' links ' genericbrowser (' links ')   ' elinks ' elinks (' elinks ')   ' Lynx ' Genericbrowser (' Lynx ')   ' w3m ' genericbrowser (' w3m ')   ' Windows-default ' Windowsdefault (2) ' MacOSX ' MacOSX (' Default ') (3) ' Safari ' MacOSX (' Safari ') (3) ' Google-chrome ' Chrome (' google-chrome ') ' Chrome ' chrome (' chrome ')   '   chromium ' chromium (' chromium ')   ' chromium-browser ' chromium (' chromium-browser ')

Instance:

#!/usr/bin/env python#-*-coding:utf-8-*-import webbrowserurl = ' http://www.pythontab.com ' webbrowser.open (URL) print Webbrowser.get ()

It's very simple, and it's going to be a deeper use. Ha, Donuts

  • 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.