某個操作點擊之后形成第二個標簽就可以進行下方的代碼的書寫
index = self.driver.current_window_handle
handles = self.driver.window_handles
current= None
for handle in handles:
if handle != index:
current= handle
self.driver.switch_to.window(current)
time.sleep(3)
#在另一個頁面需要進行的操作
.......
self.driver.close()
#切換回到原來的頁面
self.driver.switch_to.window(index)