#!/usr/bin/python
# -*- coding: UTF-8 -*-
# @Time : 2019/12/5 17:30
# @Author : shenghao/10347899@qq.com
'''test with selenium's move'''
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import cv2 as cv
import time, datetime, random,shutil
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.touch_actions import TouchActions
from selenium.webdriver.common.keys import Keys
from PIL import Image
import requests
from io import BytesIO
import cv2, time, sys
import matplotlib.pyplot as plt
import numpy as np class selenium_2_move(object):
def __init__(self):
self.headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"}
chrome_option = webdriver.ChromeOptions()
self.driver = webdriver.Chrome(executable_path="C:\Program Files\Python37\chromedriver.exe",
chrome_options=chrome_option)
self.driver.set_window_size(1440, 900) def visit_index(self):
self.driver.get(
"https://callback.58.com/antibot/verifycode?serialId=62cbf64a21ab4d309e722680c623a4e4_31ec33353c0648b7a5c97b1f2fb35976&code=22&sign=e6760461fc971994a2f3809ff536fbe9&namespace=anjuke_zufang_pc&url=.zu.anjuke.com%2Ffangyuan%2F1206610285371393%3Fisauction%3D1%26shangquan_id%3D1846")
try: click_status = WebDriverWait(self.driver, 5, 1).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class = 'code_num']/input"))).click()
time.sleep(1)
self.save_img()
except:
pass def save_img(self):
'''//div[@class = 'dvc-slider__handler'] button position'''
image_name = datetime.datetime.now().timestamp()
# self.driver.save_screenshot("%s.png" % image_name)
# print(image_name)
element = self.driver.find_element_by_xpath("//img[@class='dvc-captcha__bgImg']").screenshot_as_png
with open(r'./%s.png' % image_name, 'wb') as f:
f.write(element)
print(">>>>>>>>>>>>>>>>>>>>>> %s" % element)
time.sleep(2)
self.driver.close() if __name__ == '__main__':
h = selenium_2_move()
h.visit_index()

python selenium3 模拟点击+拖动+保存验证码 测试对象 58同城验证码的更多相关文章

  1. python selenium4 模拟点击+拖动+保存验证码 测试对象+以验证码的返回ID保存命名 58同城验证码

    #!/usr/bin/python # -*- coding: UTF-8 -*- # @Time : 2019/12/5 17:30 # @Author : shenghao/10347899@qq ...

  2. python selenium2 模拟点击+拖动 测试对象 58同城验证码

    #!/usr/bin/python # -*- coding: UTF-8 -*- # @Time : 2019/12/5 17:30 # @Author : shenghao/10347899@qq ...

  3. python selenium1 模拟点击 测试对象 58同城验证码

    #!/usr/bin/python# -*- coding: UTF-8 -*-# @Time : 2019/12/5 17:30# @Author : shenghao/10347899@qq.co ...

  4. python selenium5 模拟点击+拖动+按照指定相对坐标拖动 58同城验证码

    #!/usr/bin/python # -*- coding: UTF-8 -*- # @Time : 2019年12月9日11:41:08 # @Author : shenghao/10347899 ...

  5. 如何使用python来模拟鼠标点击(将通过实例自动化模拟在360浏览器中自动搜索"python")

    一.准备工作: 安装pywin32,后面开发需要pywin32的支持,否则无法完成与windows层面相关的操作. pywin32的具体安装及注意事项: 1.整体开发环境: 基于windows7操作系 ...

  6. Python使用selenium模拟点击(一)

    本文适合有点Python基础阅读,(没基础的话,相对的比较蒙蔽,争取能让小白能一步一步跟上来) 2019-03-05 14:53:05 前几天由于需要到一个网站进行签到~~听说Python能够模拟请求 ...

  7. python 模拟点击微信

    from PyQt5 import QtCore,QtWidgets import win32gui, win32api, win32con # 调用win32api的模拟点击功能实现ctrl+v粘贴 ...

  8. 七、Selenium与phantomJS----------动态页面模拟点击、网站模拟登录

    每天一个小实例1(动态页面模拟点击,并爬取你想搜索的职位信息) from selenium import webdriver from bs4 import BeautifulSoup # 调用环境变 ...

  9. 【小白学爬虫连载(10)】–如何用Python实现模拟登陆网站

    Python如何实现模拟登陆爬取Python实现模拟登陆的方式简单来说有三种:一.采用post请求提交表单的方式实现.二.利用浏览器登陆网站记录登陆成功后的cookies,采用get的请求方式,传入c ...

随机推荐

  1. You can't specify target table 'a' for update in FROM clause

    项目中有一个功能变动上线,其中有一张表ttt的字段cc,历史数据需要处理,把字段cc中为'xxx'的值替换为'yyy'. 表A结构如下: CREATE TABLE `ttt` ( `id` bigin ...

  2. embeddable persistent key-value store for fast storage

    A persistent key-value store for fast storage environmentsRocksDB is an embeddable persistent key-va ...

  3. 一百三十二:CMS系统之前端动态获取后台添加的轮播图

    先准备几张轮播图 排序顺序改为根据优先级倒序排 前端首页接口 @bp.route('/')def index(): banners = BannerModel.query.order_by(Banne ...

  4. 删除badi及badi interface

    转自:https://blog.csdn.net/zeewjj/article/details/7963147 Use Function Module OO_INTERFACE_DELETE and ...

  5. WPS--world使用格式刷

    1.在空白处左键点击一下即可出现格式刷

  6. mysql访问慢解决

    配置变更思路: 扩大MySQL连接数至2000,同时扩大操作系统最大文件描述符:扩大innodb缓存池 操作步骤: vi /etc/my.cnf max_connections = 2000innod ...

  7. mvn安装

    先安装jdk.jre,maven需要jdk.jre支持 1.安装 jdk 卸载自带jdk rpm -qa | grep jdk rpm -e --nodeps 下载 JDK JDK 下载地址:http ...

  8. Caché,Cache数据库连接并查询数据

    1.Caché数据库安装好后,在开始菜单中启动 2.打开管理中心,地址为:http://localhost:57772/csp/sys/UtilHome.csp ,输入用户密码,登录 3.要对表数据进 ...

  9. 工具 --- Git使用

    创建远程仓库 Github 首相在GitHub网站创建一个仓库:右上角加号➕,选择new repository 然后创建编辑仓库:名称.说明.是否公开.语言.分支风格等信息.然后创建. 复制仓库地址 ...

  10. SQL中有关DQL、DML、DDL、DCL的概念与区别?

    SQL(Structure Query Language)结构化查询语言是数据库的核心语言,是高级的非过程化编程语言.它功能强大,效率高,简单易学易维护.SQL语言基本上独立于数据库本身.使用的机器. ...