Есть ли какие-либо проблемы с мой код? или на веб-сайте есть какая-либо блокировка?
На скриншоте:
Невозможно подключиться к сайту
Возможно, веб-страница временно недоступна или полностью перемещена на новую веб-адрес.
Код: Выделить всё
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.use_chromium = True
options.add_experimental_option("prefs", {
"download.default_directory": "C:\\Users\\lag\\OneDrive\\바탕 화면\\MSDS\\Ald\\",
"download.prompt_for_download": False
"plugins.always_open_pdf_externally": True,
"safebrowsing.enabled": True,
"profile.content_settings.exceptions.automatic_downloads.*.setting": 1
})
from webdriver_manager.chrome import ChromeDriverManager
options = Options()
options.add_argument('--no-sandbox')
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service, options=options)
wait = WebDriverWait(driver, 10)
CAS = "110-54-3"
url = f"https://www.tcichemicals.com/KR/ko/search/?text={CAS}"
driver.get(url)
element = wait.until(EC.element_to_be_clickable((By.XPATH, '/html/body/main/div[4]/div/div/div[2]/div/div/ul/div[1]/div/div[2]/div[1]/div/div/a')))
element.click()
Подробнее здесь: https://stackoverflow.com/questions/783 ... nd-webpage