Chrome 開き続ける
また何の需要もないプログラムを書いてしまった.
Chromeを閉じても閉じても開き続けるプログラム.
既存のタブが開いていたりすると落ちる仕様なのは,解決したい.
あと.Ctrl + vは効く癖にCtrl + tが効かないのが納得いかない.これ解決策知っている人いたら教えてください
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import WebDriverException import time #起動 driver = webdriver.Chrome("path(ここ書き換えてね)\chromedriver.exe") #ここフォルダーまででいいと思ったのになあ #遷移 driver.get("https://www.google.co.jp") #body要素を選択 element = driver.find_element_by_tag_name("body") while True: try: element = driver.find_element_by_tag_name("body") print(driver.current_url) time.sleep(5) except WebDriverException: driver = webdriver.Chrome("path\chromedriver.exe") driver.get("https://www.google.co.jp")