[英]How to do click() command with python but on "tableau"
I'm really new to python, but I was able to do this kind of downloading files from a website :我对 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()
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.问题是我了解到您需要从网站检查元素才能执行 click(),但在画面中,我无法选择 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.嵌入式 Tableau 工作簿都放置在iframe
内,因此您无法挑出并单击该框架内的项目。 You can navigate to another url that will give you a pdf and then use selenium from there.您可以导航到另一个 url,该 url 将为您提供 pdf,然后从那里使用 selenium。
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.您需要做的就是将.pdf
添加到您尝试访问的 url 的末尾,您将在浏览器中获得工作簿的 pdf 版本。
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.然后查找下载元素( id="download"
)并使用 selenium 单击它。
See this kb from Tableau for more detail.有关更多详细信息,请参阅 Tableau 中的此知识库。
https://help.tableau.com/current/pro/desktop/en-us/link_view.htm https://help.tableau.com/current/pro/desktop/en-us/link_view.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.