LoginSignup
4
5

More than 5 years have passed since last update.

めざせpythonライブラリマスター (46)browserplus

Posted at

【ライブラリ説明】

 ブラウザ操作ができる

【準備】

 pip install lxml
 pip install mechanize
  を事前に実行

【プログラム】

 ここでは、qiitaのサイトにログインしてみます。

browserplus.py
# -*- coding: utf-8 -*-

from browserplus import BrowserPlus

bp = BrowserPlus()

# サイトを開く
bp.open('https://qiita.com/login')

# formタグ指定
bp.select_form_by('action', '/login')

# ユーザidとパスワード設定
bp['identity'] = 'your id'
bp['password'] = 'your password'

# 送信
bp.submit()

# html表示
bp.show()

【参考サイト】

 pypi
 github

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5