Skip to content
Advertisement

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?

Advertisement

Answer

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'))
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement