python selenium url 페이지 존재 여부 검사
Python에서 Selenium을 사용하여 웹 페이지의 존재 여부를 검사하고, 페이지가 존재하지 않으면 오류 메시지를 출력하며, 페이지가 존재하면 "페이지 존재"를 출력하는 스크립트를 작성할 수 있습니다. 다음은 예제 코드입니다.from selenium import webdriverfrom selenium.common.exceptions import WebDriverException, NoSuchElementExceptionfrom selenium.webdriver.chrome.service import Servicefrom selenium.webdriver.common.by import By# 웹드라이버 서비스 경로를 설정합니다.service = Service('chromedriver') # 크롬 드..
2024.11.20