I need to collect all the links from the page, open each one (alternately) in a new tab, collect data from the page and close the tab.
in selenium, I would do something similar to this:
elems = driver.find_elements_by_xpath("//a[@href]")
main_window = browser.current_window_handle
for elem in elems:
ActionChains(browser).key_down(Keys.COMMAND).click(elem.get_attribute("href")).key_up(Keys.COMMAND).perform()
browser.switch_to.window(browser.window_handles[1])
... collect data ...
browser.close()
browser.switch_to.window(main_window)
How to implement this functionality in playwright?