python使⽤appium实现京东抢购脚本3.0此⽅法不⽐⼿动快,仅仅只是作为appium的练⼿项⽬import logging
from appium import webdriver
import time
from bileby import MobileBy
from uch_action import TouchAction
class TestXueQiu:
def setup(self):
caps = {}
caps["platformName"] = "android"
caps["deviceName"] = "ld"
caps["appPackage"] = "com.jingdong.app.mall"
caps["appActivity"] = "com.jingdong.app.mall.main.MainActivity"
caps["chromedriverExecutable"] = r"E:\"
caps["noReset"] = True登陆界面图
caps["skipDeviceInitialization"] = True
滑块联轴器主要用于补偿两轴的self.driver = webdriver.Remote("127.0.0.1:4723/wd/hub", caps)
self.driver.implicitly_wait(20)
def test_search(self):
self.driver.find_element(MobileBy.XPATH,"//*[@content-desc='购物车1']").click()
self.driver.tap([(80,2109),(140,2109),(120,2080)],500)
# 全选购物车
actions = TouchAction(self.driver)
京东python入门教程actions.tap(x=120,y=2109)
ruby教程txtcycle=0
while True:
actions.perform()
用excel产生随机数
if '去结算(1)' in self.driver.page_source:
手机版的oa怎么下载break
else:
self.driver.find_element(MobileBy.XPATH,"//*[@content-desc='购物车1']").click()
time.sleep(1)
cycle+=1
logging.warning("the {} time try buy".format(cycle))
self.driver.find_element(MobileBy.XPATH, "//*[contains(@content-desc,'去结算')]").click()
self.driver.find_element(MobileBy.XPATH, "//*[contains(@text,'提交订单')]").click()
def teardown(self):
time.sleep(10)
self.driver.quit()

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。