代码:#encoding=utf-8from selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_condition…
脚本内容:#encoding=utf-8#author-夏晓旭from selenium import webdriverimport timefrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.common.exceptions import TimeoutException, NoSuchElementExceptioni…
Webdriver启用的火狐不带插件,可以自已进行配置 先找到火狐的安装路径 C:\Program Files\Mozilla Firefox 步骤说明 在CMD中使用cd命令进入firefox.exe文件所在目录(比如:C:\Program Files\Mozilla Firefox),并输入firefox.exe -ProfileManager -no-remote命令,然后按Enter键,调出“Firefox – 选择用户配置文件”操作窗口 如果firefox.exe -ProfileMa…
Python - WebDriver 识别登录验证码 没什么可说的直接上代码! #-*-coding:utf-8-*- # Time:2017/9/29 7:16 # Author:YangYangJun import time from pytesseract import * from selenium import webdriver from PIL import Image, ImageEnhance import baseinfo url = baseinfo.url driver…
最近在看python网络爬虫,于是我想自己写一个邮箱和QQ空间的自动登录的小程序, 下面以登录163邮箱和QQ空间和为例: 了解到在Web应用中经常会遇到frame/iframe 表单嵌套页面的应用,WebDriver 只能在一个页面上对元素识别与定位,对于frame/iframe 表单内嵌页面上的元素无法直接定位.这时就需要通过switch_to.frame()方法将当前定位的主体切换为frame/iframe 表单的内嵌页面中 # -*- coding: utf-8 -*-""&q…
可以直接添加用户关键字,也可以新建资源,将用户关键字添加入资源,然后导入整个资源文件 用户关键字内部实现如下: 打开126邮箱首页: Open Browser  Http://mail.126.com ie Reload Page #刷新浏览器    输入用户名:定义了变量${username} Wait Until Page Contains Element Xpath=html/body/header/a   Select Frame id=x-URS-iframe   Input Text…
转自:https://www.cnblogs.com/wuhl-89/p/7778463.html 查看元素发现id为动态,所以不选择以id定位. 使用xpath路径定位,每次获取元素都失败,最后网上查了下发现其嵌套在表单frame/iframe中,所以我们先要进入frame/iframe中,然后再定位 frame/iframe的定位方式有3种,一是通过id:二是通过name:三是xpath 例:switch_to_frame(id)  : 或是  switch_to_frame(name):若…
使用id定位Message: no such element: Unable to locate element: {"method":"id","selector":"auto-id-1537235284167"},找不到元素.原因是由于此id是动态id,每次刷新http://www.126.com页面该值都会变话.因此找不到对应元素. 使用类定位原因是:该class是含有空格的复合类.无法直接使用find_element_…
firefox可以通过 在地址栏输入:about:config 或about:aupport 来查看或修改配置信息. 这里有两种解决方式, 1.设置自动保存下载 如下图勾选:以后自动采用相同的动作处理此类文件 这样下次在下载该类型的文件时就不会这样提醒了. 如果想修改设置可以在 浏览器选项中进行修改 如下图 这样设置完成后,但是程序启动时打开的浏览器并没有按照这种配置打开. 对比下图可以发现,通过webdriver打开的浏览器与手工打开的浏览器展示的不同,这是因为webdriver打开的浏览器没…
# coding:utf-8 # __author__ = 'Mark sinoberg' # __date__ = '2016/5/26' # __Desc__ = 实现发送带有各种附件类型的邮件 import urllib, urllib2 import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.application…