from selenium import webdriver
from time import sleepfrom selenium.webdriver.common.keys import Keysbrowser=webdriver.Chrome()browser.get('https://www.hao123.com')sleep(2)browser.find_element_by_xpath("//div[@id='site']/div/ul/li[17]/a").click()sleep(2)handles=browser.window_handles #切换窗口
browser.switch_to_window(handles[-1])browser.find_element_by_link_text("注册").click()
sleep(2)print("进入注册页面")browser.find_element_by_id("UserName").send_keys('yuem168')browser.find_element_by_id("Password").send_keys('aaaaaa168')sleep(2)