python selenium登陆网易云音乐
from selenium import webdriver import time driver=webdriver.Chrome() driver.get("http://music.163.com/#/login") now_handle = driver.current_window_handle #得到当前窗口句柄 time.sleep(5) driver.switch_to.frame( driver.find_element_by_id("g_iframe")) a= driver.find_elements_by_xpath("//div[@class='u-alt']/ul/li/a") a[3].click() time.sleep(5) #name=driver.find_element_byame("iframe") #print(driver.page_source) driver.switch_to.window( driver.current_window_handle) time.sleep(5) username= driver.find_element_by_xpath("//div[@class='f-pr']/input[@type='text']") username.send_keys("用户名") passwd= driver.find_element_by_xpath("//input[@type='password']") passwd.send_keys("密码") sumbit= driver.find_element_by_xpath("//a[@class='js-primary u-btn2 u-btn2-2']").click()