Python 2.7.12、Selenium 3.4.3、Chromeバージョン62.0.3202.94(公式ビルド)(32ビット)を使用します。 次のように要素の存在を確保しようとしているが、xが存在しない場合に例外が発生していないされている間:Python Selenium 3.4.3はタイムアウトを起こさず、ハング状態になります
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait as WDW from selenium.webdriver.support import expected_conditions as EC try: WDW(driver, 20).until(EC.presence_of_element_located((By.XPATH, x))) except Exception e: print(e)
第二オプション:
try: we = driver.find_element(By.XPATH, x) except Exception e: print(e)
と、構文の問題はありますか論理的な問題?