Complete the code to switch to the new browser tab after clicking a link.
driver.find_element(By.LINK_TEXT, 'Open new tab').click() driver.[1](driver.window_handles[1])
After clicking the link, you must switch to the new window using driver.switch_to.window() with the new window handle.
Complete the code to close the current tab and switch back to the original tab.
driver.close() driver.[1](driver.window_handles[0])
After closing the current tab, switch back to the original tab using driver.switch_to.window() with the first window handle.
Fix the error in the code to correctly switch to the last opened window.
last_window = driver.window_handles[-1] driver.[1](last_window)
To switch to the last opened window, use driver.switch_to.window() with the last window handle.
Fill both blanks to create a dictionary of window handles and their titles.
windows = {handle: driver.[1](handle).title for handle in driver.[2]Switch to each window handle to get its title, iterating over driver.window_handles.
Fill all three blanks to switch to each window, print its title, and then switch back to the original window.
original = driver.[1] for handle in driver.[2]: driver.[3](handle) print(driver.title) driver.switch_to.window(original)
Save the original window handle, loop through all window handles switching to each, print the title, then switch back.