from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time
driver=webdriver.Chrome()
driver.get("http://www.sdju.edu.cn")
driver.maximize_window()
driver.find_element_by_xpath("//*[@id='link']/div/div/div/div/div/p[1]/a[3]").click()
print(driver.current_url)
driver.switch_to_window(driver.window_handles[1])
print(driver.current_url)
driver.find_element_by_xpath("/html/body/div/div[2]/div/div[1]").click()
driver.switch_to_window(driver.window_handles[2])
print("未跳转前handle")
print(driver.current_window_handle)
print("未跳转前全部handle")
print(driver.window_handles)
driver.find_element_by_xpath("//*[@id='login']/input[1]").send_keys("161003530106")
driver.find_element_by_xpath("//*[@id='login']/input[2]").send_keys("密码不能告诉你们")
driver.find_element_by_xpath("//*[@id='login']/a").click()
print("跳转后handle")
print(driver.current_window_handle)
print("跳转后全部hanle")
print(driver.window_handles)
driver.implicitly_wait(10)
xuanke=driver.find_element_by_xpath("//*[@id='nav']/li[5]/a")
webdriver.ActionChains(driver).move_to_element(xuanke).perform()
WebDriverWait(driver,10).until(lambda driver:driver.find_element_by_xpath("//*[@id='nav']/li[5]/ul/li[1]/a").is_displayed())
driver.find_element_by_xpath("//*[@id='nav']/li[5]/ul/li[1]/a").click()
driver.switch_to_window(driver.current_window_handle)
driver.find_element_by_xpath("/html/body/div/div[2]/div[3]/div[5]/div/table/tbody/tr[11]/td[6]/button").click()