0

I am new to selenium and currently in the middle of the data extraction from the website, for example: "https://asc.gov/appraiser". The navigation is like 'website->Quick Search->Apply->Download'. I want to point the 'download' output (300k result) to specific directory in excel or csv. To get the output, I am applying the below process but got stuck. Please suggest the best way to extract data.

from selenium import webdriver
from selenium.webdriver.support.ui import Select

driver = webdriver.Edge(executable_path='C:/Users/chromedriver.exe')
driver.get('https://asc.gov/appraiser')
driver.find_element_by_xpath("//input[@quicksearch-page1='TSVRadioButton']").click()quicksearchtable
driver.find_element_by_xpath("//*[@class='Downloader']").click()

download = driver.find_element_by_id("Download_0")
driver.execute_script("arguments[0].click();", download)
AKS
  • 122
  • 5

1 Answers1

0

Assuming your use case is:

Open the URL --> Click 'Apply' --> Click 'Download' --> Click 'Excel' radio button --> Click Download

Try the below code:

driver.get('https://asc.gov/appraiser')
#Below line clicks Apply button
driver.find_element(By.XPATH, '//span[text()="Apply"]').click()
#Below line clicks Download button
driver.find_element(By.XPATH, '//a[text()="Download"]').click()
#Below line clicks on excel radio button
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'excel'))).click()
#Below line clicks Download button
driver.find_element(By.ID, 'download').click()
Shawn
  • 4,064
  • 2
  • 11
  • 23