I am trying to create an automation wherein I can export a report from the Analytics tab from Studio.Youtube.
When I get to the page where I need to click the export button, nothing happens and it does not export the csv file. I have tried switching frames and windows but nothing happens.
Here is a sample of my code
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome(ChromeDriverManager().install())
urlYoutube = "https://studio.youtube.com/"
urlStack = "https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2f"
username = "sample@gmail.com"
password = "samplepassword"
driver.get(urlStack)
googleButtonStack = driver.find_element_by_xpath('//*[@id="openid-buttons"]/button[1]')
googleButtonStack.click()
userNameField = driver.find_element_by_xpath('//*[@id="identifierId"]')
userNameField.send_keys(username)
userNameNext = driver.find_element_by_xpath('//*[@id="identifierNext"]/div/button/div[2]')
userNameNext.click()
driver.implicitly_wait(10)
passField = driver.find_element_by_xpath('//*[@id="password"]/div[1]/div/div[1]/input')
passField.send_keys(password)
passFieldNext = driver.find_element_by_xpath('//*[@id="passwordNext"]/div/button/div[2]')
passFieldNext.click()
driver.implicitly_wait(15)
driver.get(urlYoutube)
driver.implicitly_wait(15)
analyticsButton = driver.find_element_by_xpath('//*[@id="menu-paper-icon-item-3"]')
analyticsButton.click()
driver.implicitly_wait(5)
# beforeWidnow = driver.current_window_handles
# print(beforeWidnow)
seeMoreButton = driver.find_element_by_xpath('//*[@id="see-more-button"]/div')
seeMoreButton.click()
driver.implicitly_wait(10)
# newWindow = driver.current_window_handles
# print(newWindow)
driver.switch_to.window(driver.find_element_by_xpath('/html/body/yta-explore-dialog/div'))
driver.implicitly_wait(5)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="export-button"]/iron-icon')))
driver.find_element_by_xpath('//*[@id="export-button"]/iron-icon').click()
# WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="text-item-1"]/ytcp-ve/div/div/yt-formatted-string'))).click()
Is there a way to click the export button and the options in it?