📜  webdriver python获取标签总数 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:13.894000             🧑  作者: Mango

代码示例1
def OpenNewTab(driver, Link):
    window_count = len(driver.window_handles)
    driver.execute_script('''window.open("'''+Link+'''","_blank");''')
    while len(driver.window_handles) != window_count+1:
        time.sleep(0.5)
    driver.switch_to.window(driver.window_handles[-1])