Selenium WebDriverの稼働チェックをするお話
SeleniumのWebDriver が 今動いているかどうかチェックするいい感じのメソッドがどうもないようなので、上手い方法ないかを検討。
とりあえず implicitly_wait(0) を応用してみる
from selenium import webdriver
def __init__(self, executable_path):
self.executable_path = executable_path
self.launch_driver()
def healthcheck_browser(self):
try:
# webdriverにWaitをいれる処理。デフォルト値0を入力し、
# エラーが発生しないかをチェック
self.driver.implicitly_wait(0)
except Exception:
# すでに quit されていれば エラー になるので再起動をかける
print("The webdriver is not working.")
launch_driver()
else:
print("The webdriver is now working.")
def launch_driver(self):
self.driver = webdriver.Chrome(executable_path=self.executable_path)
Author And Source
この問題について(Selenium WebDriverの稼働チェックをするお話), 我々は、より多くの情報をここで見つけました https://qiita.com/uguisuheiankyo/items/d67a9c3b94097b245c5a著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .