简体   繁体   中英

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. 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?

To get the id you will need the parent, and evaluate the id attribute

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'))

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.

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