简体   繁体   English

如何从表中获取元素,在编剧python中选择

[英]how to get element from a table, to be selected in playwright python

for example, it passes the 'ids' but I would just like to download from the table that contains the description 'Edição 993 link direto gdb' and the next ones that come.例如,它传递了“ids”,但我只想从包含描述“Edição 993 link direto gdb”和下一个的表中下载。 I tried to bring it with page.inner_html("tbody"), but I'm new to python, programming in general, do you have any suggestions of what I can do to get it?我试着用 page.inner_html("tbody") 带来它,但我是 python 的新手,一般编程,你对我能做些什么有什么建议吗?

To get the id you will need the parent, and evaluate the id attribute要获取 id,您需要父级,并评估 id 属性

const td = page.locator("text=Edição 993 link direto gdb");
const tr = await td.$('xpath=..')
const id = await tr.evaluate(node => node.getAttribute('id'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM