最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Error when scraping data on selection of date - Stack Overflow

programmeradmin1浏览0评论

Im trying to scrape excel data by clicking on multiple dropdown and picking dates in the following page. Have reproduced my python code below. The weblink I'm trying to scrape:

So i first select P/E, P/B & Div.Yield values, then i select "Equity" then "NIFTY 500" in Index, then chose the from and to dates and then submit.

import os
import time
import traceback
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdrivermon.by import By
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# ✅ ChromeDriver Path
chrome_driver_path = r"C:\Users\abcd\Documents\chromedriver-win64\chromedriver.exe"

# ✅ Download directory
download_path = r"C:\Users\abcd\Downloads\Indices"

# ✅ Chrome Options
options = Options()
options.add_argument("--window-size=1920x1080")
options.add_argument("--disable-popup-blocking")
options.add_argument("--disable-blink-features=AutomationControlled")

# ✅ Initialize WebDriver
service = Service(chrome_driver_path)
service.start()
driver = webdriver.Remote(service.service_url, options=options)

driver.set_page_load_timeout(300)
wait = WebDriverWait(driver, 60)

try:
    # ✅ Open the webpage
    url = ";
    print("
发布评论

评论列表(0)

  1. 暂无评论