简体   繁体   English

如何使用python但在“tableau”上执行click()命令

[英]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.

相关问题 如何使用 python 3 中的子进程模块运行 tableau 实用程序命令 - How to run tableau utility command using subprocess module in python 3 如何根据python中的点击运行命令? - How do I run a command based on a click in python? 如何使用 python 访问 Tableau 2020.2 中的 bin 目录并使用 tableau 实用程序命令行自动更新数据连接 - How to access the bin directory in Tableau 2020.2 using python and automate data connection update using tableau utility command line 如何基于单个选项在 Python 中的单击 CLI 中定义控制流并将 rest 传递给另一个命令? - How do you define control flow in a click CLI in Python based on a single option and pass the rest to another command? 如何通过python click框架定义此命令? - How to define this command by python click framework? 如何使用python中的click制作命令行程序,该命令采用运行不同脚本的单独命令参数? - How do I make a command line program using click in python that takes separates command parameters that run different scripts? SSRS 报告如何在视觉上与 python/tableau 等进行比较 - How do SSRS Reports compare visually to python/tableau etc. visuals Python单击命令名称 - Python Click command names Python Tkinter命令单击 - Python Tkinter Command Click 如何使用 Python 将数据上传到 Tableau Server - How to upload data to Tableau Server in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM