How to open a new window or tab in webdriver (Python)?

后端 未结 4 2174
终归单人心
终归单人心 2021-01-06 11:49

I have tried various commands like

driver.switch_to_window(\"_blank\")

or

driver.switch_to_window(None)

b

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-06 12:13

    I have solved the problem this way:

    a_elem = driver.find_element_by_link_text("Link with _blank")
    self.driver.get(a_elem.get_attribute('href'))
    

提交回复
热议问题