問題の概要
- PythonでSeleniumを使い,ブラウザ上での操作を自動化しようと考えています.
- 書いたコードは期待通りに動くのですが,コマンドプロンプトにはエラーが2つ表示されています.
print()
によるログから,どちらもWebページを表示しようとしているときに発生していることまでは分かりました.- ただ,これをどのようにして修正すればよいのか分からなかったので,質問を投稿しました.
エラーの内容
Failed to create shader chache entry: -2
Error in dxva_video_decode_accelerator_win.cc on line 510
書いたコード
(原因把握のため,各行でprint()
してます)
python
1# coding: UTF-8 2import re 3import config as conf 4from time import sleep 5from selenium import webdriver 6from selenium.webdriver.support.ui import WebDriverWait 7from selenium.webdriver.support import expected_conditions as EC 8from selenium.webdriver.common.by import By 9 10if __name__ == '__main__': 11 12 """ 13 ブラウザの起動 14 """ 15 16 # アクセスするページ 17 top_pg = 'https://portal.xxx.jp/xxxxx/index.jsp' 18 19 acid = conf.myid 20 acpw = conf.mypw 21 22 # ブラウザ起動オプションの設定 23 options = webdriver.ChromeOptions() 24 options.add_argument('--disable-infobars') 25 26 # Chromeを起動.オプションも指定 (今は chrome_options= ではなく options=と書く「, options=options」) 27 driver = webdriver.Chrome(executable_path='C:/Program Files/webdriver/chromedriver.exe', options=options) 28 29 print("◆The browser(chrome) has been opened!") 30 31 """ 32 ログイン処理 33 """ 34 35 # ログインページを開く 36 print("driver.get(top_pg)") 37 driver.get(top_pg) 38 39 # ユーザー名入力 40 print("driver.find_element_by_id('IDToken1').send_keys(acid)") 41 driver.find_element_by_id('IDToken1').send_keys(acid) 42 43 # ブラウザの描写が完了させるためにsleep 44 sleep(1) # wait使う? 45 46 # パスワード入力 47 print("driver.find_element_by_id('IDToken2').send_keys(acpw)") 48 driver.find_element_by_id('IDToken2').send_keys(acpw) 49 50 # ログインボタン押下(「.send_keys(Keys.ENTER)」→「.click()」) 51 print("driver.find_element_by_name('Login.Submit').click()") 52 driver.find_element_by_name('Login.Submit').click() 53 54 """ 55 お知らせをクロールする 56 """ 57 58 n = conf.bknum 59 for i in range(20): 60 notice_pg = conf.pg_pre + str(n + i) + conf.pg_suf 61 driver.get(notice_pg) 62 # 処理 63 64 """ 65 終了処理 66 """ 67 # ドライバーをクローズ: ブラウザの終了とコマンドプロンプトの終了 68 # driver.close() 69 print("◆All processes have been finished!") 70
-
「他のエラーのきっかけになりそうな部分がある」といった指摘でも構いませんので,何か情報をいただけると助かります.
-
調べてみても英語の記事ばかりで,いまいち各エラーの意味がつかめないので,そのあたりの説明もしてもらえるとありがたいです