トップ 一覧 検索 ヘルプ RSS ログイン

Tips-selenium-chromeの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!Chrome を seleniumで
Firefox は Tips-selenium

 バージョンの確認方法
 URLの入力欄で
 about: 
 と入力

!ドライバ
https://www.seleniumhq.org/download/

https://sites.google.com/a/chromium.org/chromedriver/

https://sites.google.com/a/chromium.org/chromedriver/downloads
 使用のchrome と同じ物をダウンロードの事
 今回は 88.0.4324.150

! PIP
 pip3 install selenium

!Tips
https://tanuhack.com/selenium/

https://qiita.com/rosuke/items/ebe3fa26276b6c7dd0b4

!! SAMPLE
 from selenium import webdriver
 from selenium.webdriver.common.keys import Keys as keys
 ####
 from selenium.webdriver.chrome.options import Options
 """
 """
 #########################################################################
 options = Options()
 options.add_argument('--disable-gpu')
 options.add_argument('--disable-extensions')
 ## options.add_argument('--proxy-server="direct://"')
 ## options.add_argument('--proxy-bypass-list=*')
 options.add_argument('--start-maximized')
 # ※ヘッドレスモードを使用する
 options.add_argument('--headless');
 #########################################################################
 # ドライバの位置を指定して読み込む
 ## driver = webdriver.Chrome(executable_path="./chromedriver") # 
 driver =  webdriver.Chrome(executable_path="./chromedriver",chrome_options=options) # 
 
 ### Webサイトにアクセスする
 driver.get("https://www.yahoo.co.jp/")
 
 # タイトルを取得する
 driver.title
 
 # スクリーンショットを撮る。
 driver.save_screenshot('chromeSS.png')
 
 # ブラウザを終了する
 driver.quit()