python 拼多多_Python 登录拼多多下单

你需要把chrome.exe放置到python scripts 目录下,配置要全局变量

然后cmd 打开chrome.exe --remote-debugging-port=9222 --user-data-dir="d:\temp\selenum\AutomationProfile"

py文件代码from selenium import webdriver

import time

# 产品链接

url = "http://mobile.yangkeduo.com/order_checkout.html?sku_id=300572866617&group_id=16770627522&goods_id=15520326796&goods_number=1&page_from=0&refer_page_element=single_buy&source_channel=0&refer_page_name=goods_detail&refer_page_id=10014_1563613449892_c14T9qxDEL&refer_page_sn=10014"

options = webdriver.ChromeOptions()

options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")

options.headless = True

driver = webdriver.Chrome(chrome_options=options)

driver.get(url)

driver.find_element_by_xpath("//div[@class='phone-login']").click()

driver.find_element_by_id("user-mobile").send_keys("你的账号手机")

time.sleep(2)

element = driver.find_element_by_id("code-button").click() # submit-button

check_code = input("请输入验证码:")

print(r"验证码是多少:%s" % check_code)

driver.find_element_by_id("input-code").send_keys(check_code)

time.sleep(2)

element1 = driver.find_element_by_id("submit-button").click() # submit-button

while True:

try:

time.sleep(1)

pay = driver.find_element_by_class_name('oc-pay-btn  ').click()

except Exception:

continue

for i in range(75):

driver.get(url)

driver.find_element_by_class_name('oc-p-1').click()

# 点击 立即支付

pay = driver.find_element_by_class_name('oc-pay-btn  ').click()

time.sleep(2)

now_url = driver.current_url

# 获取支付宝链接

print('第{0}次下单,当前页面的url为:{1}'.format(i,now_url))

break

print('ok')

# 886下单88单

# chrome.exe --remote-debugging-port=9222 --user-data-dir="d:\temp\selenum\AutomationProfile"

本博客源码Github地址:

请随手给个star,谢谢!

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值