0

I copied the xpath of the button that downloads the csv of the lifetime concurrent players I want, but it's not working:

url = 'https://steamdb.info/app/730/graphs/'
try:
  driver.get(url)
except:
    pass

wait = WebDriverWait(driver, 10)

driver.execute_script("window.scrollBy(0 , 750 );")

wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="highcharts-7mr3aoq-0"]/svg/g[11]/g/image'))).click()   

wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="highcharts-7mr3aoq-0"]/div/ul/li[1]'))).click() 
5
  • Seems like this page doesnt contains the id you are trying to reach. Can you recheck the id. Commented Jul 13, 2022 at 11:14
  • This is it: image.highcharts-button-symbol. It's the second button Commented Jul 13, 2022 at 11:24
  • This has class used only once in this page. You can use driver.find_elements_by_class_name("highcharts-button-symbol").click(), to download the file. If multiple then create a list and get the 1st element Commented Jul 13, 2022 at 11:27
  • I get a NoSuchElementException when I tried this Commented Jul 13, 2022 at 11:45
  • Please check my question and see if it helps: stackoverflow.com/questions/72784860/… Commented Jul 13, 2022 at 11:58

1 Answer 1

1

image is svg element. use the following xpath to identify the element first and then click.

wait = WebDriverWait(driver, 10)

wait.until(EC.visibility_of_element_located((By.XPATH, "(//*[name()='image'])[2]"))).click() //click image to open the link download csv  

wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Download CSV']"))).click() //click on download csv
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.