关于淘宝秒杀活动python代码解决方法
最近淘宝又兴起了双十一抢券活动,可是真的很难抢有没有在小编连抢五天失败后突然想到为什么不可以用python自动化试着去抢,于是便有了以下代码
```python
import os
from selenium import webdriver
import datetime
import time
from os import path
#设置Firefox浏览器
driver = webdriver.Firefox()
def login():
#扫码登陆淘宝
driver.get("https://login.taobao.com/")
time.sleep(3)
if driver.find_element_by_xpath("/html/body/div/div[2]/div[3]/div/div/div/div[1]/i"):
driver.find_element_by_xpath("/html/body/div/div[2]/div[3]/div/div/div/div[1]/i").click()
time.sleep(3)
print("请在15秒内完成扫码")
time.sleep(15)
#点击收藏夹
if driver.find_element_by_xpath("/html/body/div[1]/div/ul[2]/li[4]/div[1]/a/span[2]"):
driver.find_element_by_xpath("/html/body/div[1]/div/ul[2]/li[4]/div[1]/a/span[2]").click()
#点击第一个宝贝
if driver.find_element_by_xpath("/html/body/div[2]/div/div/