在 playwright-python 中,我知道我可以获得elementHandle
using querySelector()
.
示例(同步):
from playwright import sync_playwright
with sync_playwright() as p:
for browser_type in [p.chromium, p.firefox, p.webkit]:
browser = browser_type.launch()
page = browser.newPage()
page.goto('https://duckduckgo.com/')
element = page.querySelector('input[id=\"search_form_input_homepage\"]')
如何基于 this 获取与 this 相关的 an 元素elementHandle
?即父母,祖父母,兄弟姐妹,孩子处理?