2 Star 12 Fork 3

魂穆河 / DrissionPageX

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

✨️ 概述

基于 DrissionPage:4.0.4.4 二开,插件式 原项目地址: gitee | github

🛠 模拟手机1

from DrissionPage import ChromiumPage
from DrissionPage_Pligin.Phone import Phone, Touch

# 实例化浏览器
page = ChromiumPage()
# 初始化成为手机
Phone(page).IphoneSe()
page.get("https://www.baidu.com/")
input_node = page.ele('xpath:.//input[@name="word"]')
if input_node != None:
    input_node.input("啊,这是真的么")
# 点击使用Touch方案,click有时候无效
button_node = page.ele('xpath:.//button[text()="百度一下"]')
if button_node != None:
    Touch(button_node)
input("")

🛠 模拟手机2

from DrissionPage import ChromiumPage
from DrissionPage_Pligin.Phone import Phone, Touch, Node_Move

# 实例化浏览器
page = ChromiumPage()
# 初始化成为手机
Phone(page).IphoneSe()
page.get("https://www.geetest.com/Sensebot")
input("")
# 点击使用Touch方案,click有时候无效
button_node = page.ele('xpath:.//li[text()="滑动/滑块验证"]')
if button_node != None:
    Touch(button_node)
input("")

button_node = page.ele('xpath:.//span[text()="点击按钮进行验证"]')
if button_node != None:
    Touch(button_node)
input("")

button_node = page.ele('xpath:.//div[@class="geetest_slider_button"]')
if button_node != None:
    Node_Move(button_node, 300, 0)
input("")

🛠 监听websocket

from DrissionPage_Pligin.Listen_Ws import Listen_Ws
from DrissionPage import ChromiumPage

page = ChromiumPage()
listen_ws = Listen_Ws(page)
page.get("http://coolaf.com/tool/chattest")
listen_ws.start()
for pkg in listen_ws.steps(timeout=10):
    print(pkg)
listen_ws.stop()

🛠 监听console.log

from DrissionPage_Pligin.Listen_Console import Listen_Console
from DrissionPage import ChromiumPage

page = ChromiumPage()
listen_console = Listen_Console(page)
listen_console.start()
page.get("https://www.baidu.com/")
for pkg in listen_console.steps(timeout=10):
    print(pkg)
listen_console.stop()

🛠 利用dp打断点,获取加密参数

from DrissionPage import ChromiumPage

page = ChromiumPage()
page.get("https://hzwb.it.chinamobile.com/omspc/#/login")
page.run_cdp(
    "Debugger.enable",
)
page.run_cdp(
    "Debugger.setBreakpointByUrl",
    lineNumber=15130,
    urlRegex='https://hzwb.it.chinamobile.com/omspc/static/js/app..*.js',
)
page.run_cdp(
    "Debugger.setBreakpointsActive",
    active=True,
)
# 用dp模拟一次输入账号密码验证码登录后
page.run_js('return Object(_0x154626["c"])("123")')
input("")

🛠 切换IP

from DrissionPage import ChromiumPage
from Set_Proxies import Set_Proxies

# https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280
# https://ip.900cha.com/
page = ChromiumPage()
input("开始使用本机IP")
proxies = None
Set_Proxies(page)
while True:
    input("切换IP")
    proxies = {
        "http": "http://<proxy_ip>:<proxy_port>",
        "https": "https://<proxy_ip>:<proxy_port>",
    }
    Set_Proxies(page, proxies=proxies)

🛠 如何使用

📖 使用文档: 点击查看

交流 QQ 群: 636361957

BSD 3-Clause License Copyright (c) 2020, g1879 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

基于DrissionPage库4.0.3.4二开 展开 收起
Python
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Hunmuhe/DrissionPageX.git
git@gitee.com:Hunmuhe/DrissionPageX.git
Hunmuhe
DrissionPageX
DrissionPageX
master

搜索帮助