LoginSignup
3
3

More than 5 years have passed since last update.

Python * Seleniumで現在表示しているURLを表示する

Last updated at Posted at 2018-11-08

概要

PythonでSeleniumを使って現在表示しているURLを表示する際に、少し詰まったのでメモします。

環境

Python 3.7
Selenium 3.14.1

コード

前提として Selenium、timeがインポートされており、ブラウザドライバーの起動ができる状態が必要です。

driver.get("任意のURL")
time.sleep(1)
print(driver.current_url)

補足

url = driver.current_url
print = (url)

のように変数に格納するとなにも表示されませんでした。

3
3
1

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
3
3