博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python调用selenium
阅读量:5129 次
发布时间:2019-06-13

本文共 1673 字,大约阅读时间需要 5 分钟。

import timefrom selenium import webdriverfrom selenium.webdriver.common.touch_actions import TouchActionsfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver import ActionChains mobile = {'deviceName': 'iPhone 6'}path='E:\\chromedriver\\chromedriver.exe'options = webdriver.ChromeOptions() options.add_experimental_option('mobileEmulation',mobile)driver = webdriver.Chrome(path,chrome_options=options)driver.set_window_size(375,667)driver.get('https://api.8***')##driver.find_element_by_css_selector('#index-kw').send_keys('test')##el = driver.find_element_by_id("index-bn")##TouchActions(driver).tap(el).perform()driver.switch_to_frame(0)time.sleep(3)##driver.find_element_by_id("msgBtn").click()el = driver.find_element_by_id("msgBtn")ActionChains(driver).move_to_element(el).perform()#time.sleep(3)#ActionChains(driver).move_by_offset(10, 50).perform()##TouchActions(driver).tap(el).perform()#time.sleep(3)#ActionChains(driver).move_to_element(el).click(el).perform()TouchActions(driver).tap(el).perform()#time.sleep(3)msgCode = driver.find_element_by_id('msgCode')driver.find_element_by_id("msgCode").send_keys("1")time.sleep(3)driver.find_element_by_id("msgCode").send_keys("2")time.sleep(3)driver.find_element_by_id("msgCode").send_keys("3")time.sleep(3)driver.find_element_by_id("msgCode").send_keys("4")time.sleep(3)driver.find_element_by_id("msgCode").send_keys("5")time.sleep(3)driver.find_element_by_id("msgCode").send_keys("5")e2 = driver.find_element_by_id("okPay")ActionChains(driver).move_to_element(e2).perform()time.sleep(3)TouchActions(driver).tap(e2).perform()##TouchActions(driver).

  

转载于:https://www.cnblogs.com/Guroer/p/9660454.html

你可能感兴趣的文章
itext jsp页面打印
查看>>
HTTP之报文
查看>>
Perl正则表达式匹配
查看>>
Git
查看>>
DB Change
查看>>
nginx --rhel6.5
查看>>
Eclipse Python插件 PyDev
查看>>
selenium+python3模拟键盘实现粘贴、复制
查看>>
第一篇博客
查看>>
typeof与instanceof的区别
查看>>
网站搭建(一)
查看>>
SDWebImage源码解读之SDWebImageDownloaderOperation
查看>>
elastaticsearch
查看>>
postgreSQL 简单命令操作
查看>>
Spring JDBCTemplate
查看>>
Radon变换——MATLAB
查看>>
第五章笔记
查看>>
Iroha and a Grid AtCoder - 1974(思维水题)
查看>>
gzip
查看>>
转负二进制(个人模版)
查看>>