标签:end https page alert col cli zone webdriver info
from selenium import webdriver import time # 打开浏览器 dr = webdriver.Chrome() # 打开某个网址 dr.get(‘https://user.qzone.qq.com/2330331400/main‘) # 切换框架 dr.switch_to_frame(‘login_frame‘) time.sleep(1) dr.find_element_by_link_text(‘帐号密码登录‘).click() # 输入账号 dr.find_element_by_xpath(‘//*[@id="u"]‘).send_keys(‘2330331400‘) time.sleep(8) # 点击登录 dr.find_element_by_xpath(‘//*[@id="login_button"]‘).click() time.sleep(2) # 点击个人档 dr.find_element_by_xpath(‘//*[@id="menuContainer"]/div/ul/li[6]/a‘).click() time.sleep(2) # 请求好友的空间地址 dr.get(‘https://user.qzone.qq.com/481135195‘) time.sleep(3) # dr.switch_to_alert() # dr.find_element_by_link_text(‘我知道了‘).click() # 点击好友的个人档 dr.find_element_by_xpath(‘//*[@id="menuContainer"]/div/ul/li[6]/a‘).click() time.sleep(1) # 切换框架 dr.switch_to_frame(‘app_canvas_frame‘) # 点击好友的个人资料 dr.find_element_by_link_text(‘个人资料‘).click() # dr.find_element_by_link_text(‘//*[@id="info_link"]‘).click() # 输入当前页面的源代码 print(dr.page_source) dr.get(‘https://user.qzone.qq.com/495483884‘) time.sleep(3) # dr.switch_to_alert() # dr.find_element_by_link_text(‘我知道了‘).click() dr.find_element_by_xpath(‘//*[@id="menuContainer"]/div/ul/li[6]/a‘).click() time.sleep(1) dr.switch_to_frame(‘app_canvas_frame‘) dr.find_element_by_link_text(‘个人资料‘).click() # dr.find_element_by_link_text(‘//*[@id="info_link"]‘).click() print(dr.page_source)
标签:end https page alert col cli zone webdriver info
原文地址:https://www.cnblogs.com/duanlinxiao/p/9847706.html