from selenium import webdriver from selenium.webdriver.common.by import 按导入时间
类 SwtWin():
def swwn(self):
driver=webdriver.Firefox()
driver.get("https://learn.letskodeit.com/p/practice")
driver.implicitly_wait(2)
ParentWin=driver.current_window_handle
print(ParentWin)
driver.find_element_by_id("openwindow").click()
windows=driver.window_handles
print(windows)
for Tab in windows:
print(Tab)
if Tab != ParentWin:
print("Switched to sub window")
driver.switch_to.window(Tab)
print(Tab)
sel=driver.find_element_by_partial_link_text("Login")
sel.click()
driver.close()
break
driver.switch_to.window(ParentWin)
driver.execute_script("window.scrollBy(0, 1000);")
driver.quit()
SwtWin().swwn()
绝地无双
相关分类