zoukankan      html  css  js  c++  java
  • selenium3 qq邮箱上传下载

    实现功能:qq邮箱上传附件

    定位元素:此为input标签,可以直接用send_keys方法,进入到邮箱页面后,首先click'写信',driver需切换到frame

    通过name定位:'UploadFile'代码如下:

    # _*_ coding:utf-8 _*_
    from selenium import  webdriver
    from selenium.webdriver.common.action_chains import  ActionChains
    from pywinauto.application import Application
    import  time,os
    driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe')
    driver.maximize_window()
    driver.get('https://mail.qq.com/cgi-bin/loginpage')
    time.sleep(5)
    driver.switch_to.frame("login_frame")
    driver.find_element_by_name('u').send_keys('2574674466')
    driver.find_element_by_name('p').send_keys('')
    driver.find_element_by_id('login_button').click()
    
    time.sleep(3)
    driver.find_element_by_id('composebtn').click()
    time.sleep(3)
    driver.switch_to.frame("mainFrame")
    driver.find_element_by_id('subject').send_keys('test')
    time.sleep(3)
    driver.find_element_by_name('UploadFile').).send_keys('')//文件路径
  • 相关阅读:
    半平面交模板
    poj2420(模拟退火大法好)
    hdu4266(三维凸包模板题)
    三维凸包模板
    三维空间直线最近点对hdu4741
    3维计算几何模板
    hdu1174(3维射线与圆是否相交)
    重点记忆
    UNICODE,GBK,UTF-8区别
    AJAX 基础
  • 原文地址:https://www.cnblogs.com/tim2016/p/7845219.html
Copyright © 2011-2022 走看看