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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kegne