我正在使用selenium創建一個webdriver實例來進行一些自動化工作。我一次打開多個選項卡,並希望知道是否有辦法打開所有選項卡的URL。使用Python獲取所有打開的選項卡的URL
driver=webdriver.Chrome()
driver.current_url
上述代碼僅向我提供了第一個選項卡的URL。我想另一件事是:
driver.window_handles[0].current_url
上述解決方案未能爲window_handles()
返回一個Unicode對象不包含current_url
我不想通過所有選項卡會積極,以便找到,因爲它會破壞每個標籤的current_url
手頭的自動化任務。
選中此https://stackoverflow.com/questions/28715942/how-do-i-switch-to硒活動標籤 – karansthr
https://stackoverflow.com/questions/40458138/switch-between-tabs-and-perform-action-on-individual-using-selnium# – karansthr