[英]How to run tableau utility command using subprocess module in python 3
[英]How to do click() command with python but on "tableau"
我對 python 真的很陌生,但我能夠從網站上下載文件:
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()
它對我有用,下載了這些文件。
問題是我了解到您需要從網站檢查元素才能執行 click(),但在畫面中,我無法選擇 elemetn。 怎么做? 謝謝。
嵌入式 Tableau 工作簿都放置在iframe
內,因此您無法挑出並單擊該框架內的項目。 您可以導航到另一個 url,該 url 將為您提供 pdf,然后從那里使用 selenium。
您需要做的就是將.pdf
添加到您嘗試訪問的 url 的末尾,您將在瀏覽器中獲得工作簿的 pdf 版本。
http://<servername>/#/views/<workbook>/sheet?:iid=7
會變成
http://<servername>/#/views/<workbook>/sheet.pdf
然后查找下載元素( id="download"
)並使用 selenium 單擊它。
有關更多詳細信息,請參閱 Tableau 中的此知識庫。
https://help.tableau.com/current/pro/desktop/en-us/link_view.htm
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.