Python
# -*- coding: utf-8 -*- """ @Time: 2018/5/25 @Author: songhao @微信公众号: zeropython @File: crawl.py """ # pip3 install Appium-Python-Client from <span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/appium" title="View all posts in appium" target="_blank">appium</a></span> import webdriver from <span class="wp_keywordlink"><a href="http://www.168seo.cn/selenium/" title="selenium">selenium</a></span>.webdriver.common.by import By from <span class="wp_keywordlink"><a href="http://www.168seo.cn/selenium/" title="selenium">selenium</a></span>.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC server = 'http://localhost:4723/wd/hub' desired_caps = { "platformName": "Android", "deviceName": "SM_G9550", "appPackage": "com.tencent.mobileqq", "appActivity": "com.tencent.mobileqq.activity.SplashActivity" } driver = webdriver.Remote(server, desired_caps) wait = WebDriverWait(driver, 30) login = wait.until(EC.presence_of_element_located((By.ID, "com.tencent.mobileqq:id/btn_login"))) login.click() qqz = wait.until(EC.presence_of_element_located((By.ID, "请输入QQ号码或手机或邮箱"))) qqz.set_text('账号') qqm = wait.until(EC.presence_of_element_located((By.ID, "密码 安全"))) qqm.send_keys("密码") sub = wait.until(EC.presence_of_element_located((By.ID, "登录"))) sub.click() bd = wait.until(EC.presence_of_element_located((By.ID, "已关闭"))) bd.click() el8 = wait.until(EC.presence_of_element_located((By.ID, "com.tencent.mobileqq:id/ivTitleBtnLeft"))) el8.click()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
@Time: 2018/5/25
@Author: songhao
@微信公众号: zeropython
@File: crawl.py
"""
 
# pip3 install Appium-Python-Client
from appium import webdriver
from selenium . webdriver . common . by import By
from selenium . webdriver . support . ui import WebDriverWait
from selenium . webdriver . support import expected_conditions as EC
server = 'http://localhost:4723/wd/hub'
desired_caps = {
"platformName" : "Android" ,
"deviceName" : "SM_G9550" ,
"appPackage" : "com.tencent.mobileqq" ,
"appActivity" : "com.tencent.mobileqq.activity.SplashActivity"
}
 
driver = webdriver . Remote ( server , desired_caps )
 
wait = WebDriverWait ( driver , 30 )
 
login = wait . until ( EC . presence_of_element_located ( ( By . ID , "com.tencent.mobileqq:id/btn_login" ) ) )
login . click ( )
qqz = wait . until ( EC . presence_of_element_located ( ( By . ID , "请输入QQ号码或手机或邮箱" ) ) )
qqz . set_text ( '账号' )
 
 
qqm = wait . until ( EC . presence_of_element_located ( ( By . ID , "密码 安全" ) ) )
qqm . send_keys ( "密码" )
sub =    wait . until ( EC . presence_of_element_located ( ( By . ID , "登录" ) ) )
sub . click ( )
bd = wait . until ( EC . presence_of_element_located ( ( By . ID , "已关闭" ) ) )
bd . click ( )
el8 = wait . until ( EC . presence_of_element_located ( ( By . ID , "com.tencent.mobileqq:id/ivTitleBtnLeft" ) ) )
el8 . click ( )
 



  • zeropython 微信公众号 5868037 QQ号 5868037@qq.com QQ邮箱
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐