A multi-form, multi-window switch

First, a multi-form switching

driver.switch_to.frame (id / name) may take the form of a default name or id attribute directly.

If not available iframe id and name attribute, an iframe may be positioned through the first XPath, and then locate the object passed driver.switch_to.frame (positioning objects)

driver.switch_to.parent_frame () to return to previous form

switch_to.default_content () jump back to the outermost layer of the page

 

Second, the multi-window switch

driver.current_window_handle: get the current window handle

driver.window_handles: Get all window handle, returns a list

switch_to_window (handle): switching window function, parameter fill handle

 

Guess you like

Origin www.cnblogs.com/ice-2018/p/11349833.html