I'm really new to python, but I was able to do this kind of downloading files from a website :
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("http://www.yeastgenome.org/locus/S000001142/overview")
wait = WebDriverWait(driver, 4)
wait.until(EC.element_to_be_clickable((By.XPATH,"/html/body/div/div/div[2]/div[2]/section[2]/div/div[1]/div/div/div/div[1]/div/div[1]/div/a"))).click()
for i in range(1,5):
i = str(i)
wait.until(EC.element_to_be_clickable((By.XPATH,"/html/body/div/div/div[2]/div[2]/section[2]/div/div[1]/div/div/div/div[1]/div/div[1]/div/ul/li["+i+"]/a"))).click()
it works for me, downloaded those file.
the thing is I learnt that you need to inspect element from website to do click(), but in tableau, i can't do select elemetn. How to do it? THanks.
Embedded Tableau workbooks are all placed inside of an iframe
so you can't single out and click on items within that frame. You can navigate to another url that will give you a pdf and then use selenium from there.
All you need to do is add .pdf
to the end of the url you are trying to access and you will get a pdf version of the workbook in the browser.
http://<servername>/#/views/<workbook>/sheet?:iid=7
will become
http://<servername>/#/views/<workbook>/sheet.pdf
Then look for the download element ( id="download"
) and click it with selenium.
See this kb from Tableau for more detail.
https://help.tableau.com/current/pro/desktop/en-us/link_view.htm
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.