Python learning more window switching

Multi-window switching:

from selenium import webdriver

d = webdriver.Firefox()

d.window_handles #Show all windows

d.current_window_handle#x displays the current window

d.switch_to_window(d.window_handles[1])#Display the first window

d.current_url

d.current_window_handle#x displays the current window

d.switch_to_window(d.window_handles[2])

d.close()

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325166740&siteId=291194637