I'm able to login to a website but I couldn't figure it out how to click "Download as CSV". I've tried XPATH and CSS Selector.
Here is the picture of the HTML.
The dashboard is combined with many widgets. Don't know if that would impact anything. Please let me know if you need more information. Thank you : )
Below is code
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
import time
#### location of chrome
driver = webdriver.Chrome(r'F:\User\Downloads\chromedriver.exe')
#### log in website 1
driver.get('https://www.yardipca.com/39444siteminderlive/')
### 1st door ( login& password)
name_1st = driver.find_element_by_name('USER')
name_1st.clear()
name_1st.send_keys('my_account')
passowrd_1st = driver.find_element_by_name('PASSWORD')
passowrd_1st.clear()
passowrd_1st.send_keys('my_password')
### login botton
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH,"/html/body/form/div/center/table[2]/tbody/tr[3]/td[2]/table/tbody/tr[8]/td[2]/input[6]"))).click()
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.LINK_TEXT,"P260 Live System (SAN/HOC)"))).click()
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="acceptButton"]'))).click()
time.sleep(10)
#### log in website 2
driver.get('https://www.yardiasptx11.com/39444p260livehoc/jsp/index.jsp')
### 2nd door ( login& password)
name_2nd = driver.find_element_by_name('userId')
name_2nd.send_keys('my_account')
passowrd_2nd = driver.find_element_by_name('password')
passowrd_2nd.send_keys('my_password')
### login botton
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//[@id="standardLoginForm"]/div[3]/button'))).click()
time.sleep(5)
### Dropdown button
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="widget_937242"]/div[1]/div[1]'))).click()
# //*[@id="widget_937242"]/div[1]/div[1]
# //*[@id="widget_937242"]/div[1]/div[1]/a
# //*[@id="widget_937242"]/div[1]/div[1]/a/span
### download file
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.CSS_SELECTOR,'#widget_937242 > div.panel-heading.ui-sortable-handle > div.btn-group.pull-right.print-hide.open > ul > li:nth-child(2) > a'))).click()
time.sleep(10)
The error popped up.
File "f:\User\Downloads\yardi.py", line 57, in
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="widget_937242"]/div1/div1'))).click()
File "F:\Anaconda3\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: