Home > OS >  How to fix button in Selenium Python not clickable?
How to fix button in Selenium Python not clickable?

Time:07-16

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() 

CodePudding user response:

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
  • Related