iphone14来了,可是约好的你去哪了

JavaDog程序狗
JavaDog程序狗
发布于 2022-09-29 / 1038 阅读
0
0

iphone14来了,可是约好的你去哪了

前言

⏲️本文阅读时长:约10分钟

🎯主要目标:

1.展示iphone14/iphone pro python自动化脚本 Gitee地址
2.提供有货通知订阅功能,方便老铁们接收到有货通知邮件,点击查看,收到邮件第一时间去官网下单,还是有机会的
3.更新chromedriver.exe ,本人谷歌105.0.5195.102。查看版本匹配下载请访问

https://registry.npmmirror.com/binary.html?path=chromedriver/

老规矩先水俩图

iphone14抢购自动化测试脚本
iphone14-pro/pro-max抢购自动化测试脚本
邮件有货通知立马访问

![](https://img-blog.csdnimg.cn/4428f6cdfa8f40f1a192223e6f8a69db.jpeg


前情回顾

iphone13到底香不香,真的这么难抢?

区别差异

1.地址选择处苹果官网变更了DOM结构,目前14中python脚本采用新的定位方式

selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
driver.execute_script("arguments[0].click();", selectprovice)

2.流程更改,14新增填写取货人姓/名及身份证后4位流程

3.总体比较差别不大,苹果工程师也是高端偷懒,哈哈


上代码

iphone14脚本

TIPS:本次苹果比较坑,有可能提示可以取货,但是到最后一步提示无法到店取货,请注意

from selenium import webdriver
from datetime import datetime
from selenium.webdriver.support.select import Select
import pdb
import time

# iphone14 自动化测试
print("iphone14 自动化测试开始")

# 访问测试的url定义
url = "https://www.apple.com.cn/shop/buy-iphone/iphone-14"

# 1. 创建浏览器对象  这里的Chrome中的变量是chromedriver的驱动地址
driver = webdriver.Chrome()

# 2. 跳转到apple官网
driver.get(url)

# 3. 隐式等待 设置 防止预售的网络的阻塞
driver.implicitly_wait(10)

# 4. 开始选择规格【此处我选择了-14 pro】
element_sku = driver.find_element_by_name('dimensionScreensize')
driver.implicitly_wait(10)
element_sku.click()

# 4.2 选择颜色【此处我选择了-银色】
element_color = driver.find_element_by_xpath(
    '//*[@value="midnight"]')
driver.execute_script("arguments[0].click();", element_color)
driver.implicitly_wait(10)

# 4.3 选择内存【此处我选择了-256g】
element_memory = driver.find_element_by_xpath(
    '//*[@value="256gb"]')
driver.execute_script("arguments[0].click();", element_memory)
driver.implicitly_wait(10)

# 4.4 你是否有智能手机要折抵 【此处我选择了-没有旧机折扣】
element_old = driver.find_element_by_xpath('//*[@id="noTradeIn"]')
driver.execute_script("arguments[0].click();", element_old)
driver.implicitly_wait(10)

# 4.5 Applecare 【此处我选择了-无Applecare】
element_care = driver.find_element_by_id('iphonexs_ac_iup_noapplecare_label')
driver.execute_script("arguments[0].click();", element_care)
driver.implicitly_wait(10)

# 4.6 添加到购物袋
element_car = driver.find_element_by_xpath(
    '//*[@value="add-to-cart"]')
driver.execute_script("arguments[0].click();", element_car)
driver.implicitly_wait(10)

# 5 页面跳转查看购物袋
element_check = driver.find_element_by_xpath(
    '//*[@value="proceed"]')
driver.execute_script("arguments[0].click();", element_check)
driver.implicitly_wait(10)

# 6 结账
element_check_out = driver.find_element_by_xpath(
    '//*[@id="shoppingCart.actions.checkout"]')
driver.execute_script("arguments[0].click();", element_check_out)
driver.implicitly_wait(10)

# 7.1 输入用户名
element_username = driver.find_element_by_id(
    'signIn.customerLogin.appleId')
element_username.send_keys('862422xxx@qq.com')
driver.implicitly_wait(10)

# 7.2 输入密码
element_password = driver.find_element_by_id(
    'signIn.customerLogin.password')
element_password.send_keys('xxx')
driver.implicitly_wait(10)

# 7.3 点击登录
element_login = driver.find_element_by_id(
    'signin-submit-button')
element_login.click()
driver.implicitly_wait(10)

# 8.1 你希望如何收到订单商品  【此处我选择了-我要取货】
element_want_order = driver.find_element_by_id(
    'fulfillmentOptionButtonGroup1')
driver.execute_script("arguments[0].click();", element_want_order)
time.sleep(2)

# 8.2 点击显示此地附近的零售店
selectdistrict = driver.find_element_by_xpath(
    '//*[@data-autom="fulfillment-pickup-store-search-button"]')
driver.execute_script("arguments[0].click();", selectdistrict)
time.sleep(2)

# 8.3 点击山东
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 8.4 点击青岛
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'青岛')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 8.5 点击市南
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'市南区')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 因为无货需要判断元素是否可以点击
isOK = driver.find_element_by_xpath(
    '//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input').is_enabled()
isOKFlag = bool(1 - isOK)
#print("准备isOKFlag   " + str(isOKFlag))

# while循环查看是否有货
while isOKFlag:
    try:
        # 重新调用省市区
        #print("进来了isOKFlag   " + str(isOKFlag))
        selectdistrict = driver.find_element_by_xpath('//*[@data-autom="fulfillment-pickup-store-search-button"]')
        driver.execute_script("arguments[0].click();", selectdistrict)
        time.sleep(1)

        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
        driver.execute_script("arguments[0].click();", selectprovice)
        time.sleep(1)

        # 8.4 点击青岛
        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'青岛')]")
        driver.execute_script("arguments[0].click();", selectprovice)
        time.sleep(1)

        # 8.5 点击市南
        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'市南区')]")
        driver.execute_script("arguments[0].click();", selectprovice)

        isOK = driver.find_element_by_xpath('//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input').is_enabled()
        isOKFlag = bool(1 - isOK)
        #print("最后了isOK   " + str(isOKFlag))
    except:
        print("异常了   ")
        break

# tips: 经验证,苹果官网如果在付款页面之前实体店无货,若有货后在结算页面也无法选择实体店
# 8.6 选择取货零售店 【此处我选择了-Apple 青岛万象城】
element_pickupTab = driver.find_element_by_xpath('//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input')
driver.execute_script("arguments[0].click();", element_pickupTab)
driver.implicitly_wait(20)


# 8.7 继续填写取货详情
element_checkout = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_checkout)
time.sleep(2)

# 8.8 选择取货时间 【根据时间自己定】
element_pickup_time = driver.find_element_by_xpath(
    '//*[@value="18"]')
driver.execute_script("arguments[0].click();", element_pickup_time)
time.sleep(2)

# 8.9 选择取货时间段 【此处我选择了-默认第一个时间段】
element_time_quantum = driver.find_element_by_xpath(
    '//*[@id="checkout.fulfillment.pickupTab.pickup.timeSlot.dateTimeSlots.timeSlotValue"]')
Select(element_time_quantum).select_by_index(1)
time.sleep(2)

# 8.10 继续填写取货详情
element_checkout = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.implicitly_wait(15)
driver.execute_script("arguments[0].click();", element_checkout)
element_checkout.click()
driver.implicitly_wait(20)

# 9.1 请填写姓氏
lastName = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.lastName')
lastName.send_keys('胡')
driver.implicitly_wait(10)

# 9.2 请填写名字
firstName = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.firstName')
firstName.send_keys('东旭')
driver.implicitly_wait(10)


# 9.3 请填写电子邮件
emailAddress = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.emailAddress')
emailAddress.send_keys('862422xxx@qq.com')
driver.implicitly_wait(10)

# 9.4 请填写手机号
emailAddress = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.fullDaytimePhone')
emailAddress.send_keys('1830639xxxx')
driver.implicitly_wait(10)

# 9.5 请填写身份证后四位
nationalIdSelf = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.nationalIdSelf.nationalIdSelf')
nationalIdSelf.send_keys('403X')
driver.implicitly_wait(10)

# 9.6 继续选择付款方式
element_checkoutPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_checkoutPay)
driver.implicitly_wait(10)

# 10 立即下单 【此处我选择了-微信支付】
element_billingOptions = driver.find_element_by_id(
    'checkout.billing.billingoptions.wechat_label')
driver.execute_script("arguments[0].click();", element_billingOptions)
driver.implicitly_wait(10)

# 11.1 确定
element_orderPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_orderPay)
time.sleep(2)

# 12 确认订单
element_endPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_endPay)
driver.implicitly_wait(15)

# 11 退出浏览器
time.sleep(10)
# driver.quit()

print("iphone14 自动化测试结束")

iphone14 pro脚本

TIPS:苹果应该有流量请求限流,会经常提示503,请注意

from selenium import webdriver
from datetime import datetime
from selenium.webdriver.support.select import Select
import pdb
import time

# iphone14 自动化测试
print("iphone14-pro 自动化测试开始")

# 访问测试的url定义
url = "https://www.apple.com.cn/shop/buy-iphone/iphone-14-pro"

# 1. 创建浏览器对象  这里的Chrome中的变量是chromedriver的驱动地址
driver = webdriver.Chrome()

# 2. 跳转到apple官网
driver.get(url)

# 3. 隐式等待 设置 防止预售的网络的阻塞
driver.implicitly_wait(10)

# 4. 开始选择规格【此处我选择了-14 pro】
element_sku = driver.find_element_by_name('dimensionScreensize')
driver.implicitly_wait(10)
element_sku.click()

# 4.2 选择颜色【此处我选择了-银色】
element_color = driver.find_element_by_xpath(
    '//*[@value="silver"]')
driver.execute_script("arguments[0].click();", element_color)
driver.implicitly_wait(10)

# 4.3 选择内存【此处我选择了-256g】
element_memory = driver.find_element_by_xpath(
    '//*[@value="256gb"]')
driver.execute_script("arguments[0].click();", element_memory)
driver.implicitly_wait(10)

# 4.4 你是否有智能手机要折抵 【此处我选择了-没有旧机折扣】
element_old = driver.find_element_by_xpath('//*[@id="noTradeIn"]')
driver.execute_script("arguments[0].click();", element_old)
driver.implicitly_wait(10)

# 4.5 Applecare 【此处我选择了-无Applecare】
element_care = driver.find_element_by_id('iphonexs_ac_iup_noapplecare_label')
driver.execute_script("arguments[0].click();", element_care)
driver.implicitly_wait(10)

# 4.6 添加到购物袋
element_car = driver.find_element_by_xpath(
    '//*[@value="add-to-cart"]')
driver.execute_script("arguments[0].click();", element_car)
driver.implicitly_wait(10)

# 5 页面跳转查看购物袋
element_check = driver.find_element_by_xpath(
    '//*[@value="proceed"]')
driver.execute_script("arguments[0].click();", element_check)
driver.implicitly_wait(10)

# 6 结账
element_check_out = driver.find_element_by_xpath(
    '//*[@id="shoppingCart.actions.checkout"]')
driver.execute_script("arguments[0].click();", element_check_out)
driver.implicitly_wait(10)

# 7.1 输入用户名
element_username = driver.find_element_by_id(
    'signIn.customerLogin.appleId')
element_username.send_keys('862422xxx@qq.com')
driver.implicitly_wait(10)

# 7.2 输入密码
element_password = driver.find_element_by_id(
    'signIn.customerLogin.password')
element_password.send_keys('xxxxx')
driver.implicitly_wait(10)

# 7.3 点击登录
element_login = driver.find_element_by_id(
    'signin-submit-button')
element_login.click()
driver.implicitly_wait(10)

# 8.1 你希望如何收到订单商品  【此处我选择了-我要取货】
element_want_order = driver.find_element_by_id(
    'fulfillmentOptionButtonGroup1')
driver.execute_script("arguments[0].click();", element_want_order)
time.sleep(2)

# 8.2 点击显示此地附近的零售店
selectdistrict = driver.find_element_by_xpath(
    '//*[@data-autom="fulfillment-pickup-store-search-button"]')
driver.execute_script("arguments[0].click();", selectdistrict)
time.sleep(2)

# 8.3 点击山东
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 8.4 点击青岛
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'青岛')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 8.5 点击市南
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'市南区')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 因为无货需要判断元素是否可以点击
isOK = driver.find_element_by_xpath(
    '//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input').is_enabled()
isOKFlag = bool(1 - isOK)
#print("准备isOKFlag   " + str(isOKFlag))

# while循环查看是否有货
while isOKFlag:
    try:
        # 重新调用省市区
        #print("进来了isOKFlag   " + str(isOKFlag))
        selectdistrict = driver.find_element_by_xpath('//*[@data-autom="fulfillment-pickup-store-search-button"]')
        driver.execute_script("arguments[0].click();", selectdistrict)
        time.sleep(1)

        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
        driver.execute_script("arguments[0].click();", selectprovice)
        time.sleep(1)

        # 8.4 点击青岛
        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'青岛')]")
        driver.execute_script("arguments[0].click();", selectprovice)
        time.sleep(1)

        # 8.5 点击市南
        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'市南区')]")
        driver.execute_script("arguments[0].click();", selectprovice)

        isOK = driver.find_element_by_xpath('//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input').is_enabled()
        isOKFlag = bool(1 - isOK)
        #print("最后了isOK   " + str(isOKFlag))
    except:
        print("异常了   ")
        break

# 8.6 选择取货零售店 【此处我选择了-Apple 青岛万象城】
element_pickupTab = driver.find_element_by_xpath('//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input')
driver.execute_script("arguments[0].click();", element_pickupTab)
driver.implicitly_wait(20)

# 8.7 继续填写取货详情
element_checkout = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_checkout)
time.sleep(2)

# 8.8 选择取货时间 【根据时间自己定】
element_pickup_time = driver.find_element_by_xpath(
    '//*[@value="18"]')
driver.execute_script("arguments[0].click();", element_pickup_time)
time.sleep(2)

# 8.9 选择取货时间段 【此处我选择了-默认第一个时间段】
element_time_quantum = driver.find_element_by_xpath(
    '//*[@id="checkout.fulfillment.pickupTab.pickup.timeSlot.dateTimeSlots.timeSlotValue"]')
Select(element_time_quantum).select_by_index(1)
time.sleep(2)

# 8.10 继续填写取货详情
element_checkout = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.implicitly_wait(15)
driver.execute_script("arguments[0].click();", element_checkout)
element_checkout.click()
driver.implicitly_wait(20)

# 9.1 请填写姓氏
lastName = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.lastName')
lastName.send_keys('胡')
driver.implicitly_wait(10)

# 9.2 请填写名字
firstName = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.firstName')
firstName.send_keys('xx')
driver.implicitly_wait(10)

# 9.3 请填写电子邮件
emailAddress = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.emailAddress')
emailAddress.send_keys('862422xxx@qq.com')
driver.implicitly_wait(10)

# 9.4 请填写手机号
emailAddress = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.fullDaytimePhone')
emailAddress.send_keys('1830639xxxx')
driver.implicitly_wait(10)

# 9.5 请填写身份证后四位
nationalIdSelf = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.nationalIdSelf.nationalIdSelf')
nationalIdSelf.send_keys('403X')
driver.implicitly_wait(10)

# 9.6 继续选择付款方式
element_checkoutPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_checkoutPay)
driver.implicitly_wait(10)

# 10 立即下单 【此处我选择了-微信支付】
element_billingOptions = driver.find_element_by_id(
    'checkout.billing.billingoptions.wechat_label')
driver.execute_script("arguments[0].click();", element_billingOptions)
driver.implicitly_wait(10)

# 11.1 确定
element_orderPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_orderPay)
time.sleep(2)

# 12 确认订单
element_endPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_endPay)
driver.implicitly_wait(15)

# 11 退出浏览器
time.sleep(10)
# driver.quit()

print("iphone14-pro 自动化测试结束")

iphone14 pro-max脚本

from selenium import webdriver
from datetime import datetime
from selenium.webdriver.support.select import Select
import pdb
import time

# iphone14 自动化测试
print("iphone14-pro-max 自动化测试开始")

# 访问测试的url定义
url = "https://www.apple.com.cn/shop/buy-iphone/iphone-14-pro"

# 1. 创建浏览器对象  这里的Chrome中的变量是chromedriver的驱动地址
driver = webdriver.Chrome()

# 2. 跳转到apple官网
driver.get(url)

# 3. 隐式等待 设置 防止预售的网络的阻塞
driver.implicitly_wait(10)

# 4. 开始选择规格【此处我选择了-14 pro-max】
element_sku = driver.find_element_by_xpath(
    '//*[@value="6_7inch"]')
driver.execute_script("arguments[0].click();", element_sku)

# 4.2 选择颜色【此处我选择了-银色】
element_color = driver.find_element_by_xpath(
    '//*[@value="silver"]')
driver.execute_script("arguments[0].click();", element_color)
driver.implicitly_wait(10)



# 4.3 选择内存【此处我选择了-256g】
element_memory = driver.find_element_by_xpath(
    '//*[@value="256gb"]')
driver.execute_script("arguments[0].click();", element_memory)
driver.implicitly_wait(10)

# 4.4 你是否有智能手机要折抵 【此处我选择了-没有旧机折扣】
element_old = driver.find_element_by_xpath('//*[@id="noTradeIn_label"]')
driver.execute_script("arguments[0].click();", element_old)
driver.implicitly_wait(10)

# 4.5 Applecare 【此处我选择了-无Applecare】
element_care = driver.find_element_by_id('iphone11promax_ac_iup_noapplecare_label')
driver.execute_script("arguments[0].click();", element_care)
driver.implicitly_wait(10)

# 4.6 添加到购物袋
element_car = driver.find_element_by_xpath(
    '//*[@value="add-to-cart"]')
driver.execute_script("arguments[0].click();", element_car)
driver.implicitly_wait(10)

# 5 页面跳转查看购物袋
element_check = driver.find_element_by_xpath(
    '//*[@value="proceed"]')
driver.execute_script("arguments[0].click();", element_check)
driver.implicitly_wait(10)

# 6 结账
element_check_out = driver.find_element_by_xpath(
    '//*[@id="shoppingCart.actions.checkout"]')
driver.execute_script("arguments[0].click();", element_check_out)
driver.implicitly_wait(10)

# 7.1 输入用户名
element_username = driver.find_element_by_id(
    'signIn.customerLogin.appleId')
element_username.send_keys('xxx@qq.com')
driver.implicitly_wait(10)

# 7.2 输入密码
element_password = driver.find_element_by_id(
    'signIn.customerLogin.password')
element_password.send_keys('xxx')
driver.implicitly_wait(10)

# 7.3 点击登录
element_login = driver.find_element_by_id(
    'signin-submit-button')
element_login.click()
driver.implicitly_wait(10)

# 8.1 你希望如何收到订单商品  【此处我选择了-我要取货】
element_want_order = driver.find_element_by_id(
    'fulfillmentOptionButtonGroup1')
driver.execute_script("arguments[0].click();", element_want_order)
time.sleep(2)

# 8.2 点击显示此地附近的零售店
selectdistrict = driver.find_element_by_xpath(
    '//*[@data-autom="fulfillment-pickup-store-search-button"]')
driver.execute_script("arguments[0].click();", selectdistrict)
time.sleep(2)

# 8.3 点击山东
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 8.4 点击青岛
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'青岛')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 8.5 点击市南
selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'市南区')]")
driver.execute_script("arguments[0].click();", selectprovice)
time.sleep(2)

# 因为无货需要判断元素是否可以点击
isOK = driver.find_element_by_xpath(
    '//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input').is_enabled()
isOKFlag = bool(1 - isOK)
#print("准备isOKFlag   " + str(isOKFlag))

# while循环查看是否有货
while isOKFlag:
    try:
        # 重新调用省市区
        #print("进来了isOKFlag   " + str(isOKFlag))
        selectdistrict = driver.find_element_by_xpath('//*[@data-autom="fulfillment-pickup-store-search-button"]')
        driver.execute_script("arguments[0].click();", selectdistrict)
        time.sleep(1)

        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'山东')]")
        driver.execute_script("arguments[0].click();", selectprovice)
        time.sleep(1)

        # 8.4 点击青岛
        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'青岛')]")
        driver.execute_script("arguments[0].click();", selectprovice)
        time.sleep(1)

        # 8.5 点击市南
        selectprovice =  driver.find_element_by_xpath("//button[contains(text(),'市南区')]")
        driver.execute_script("arguments[0].click();", selectprovice)

        isOK = driver.find_element_by_xpath('//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input').is_enabled()
        isOKFlag = bool(1 - isOK)
        #print("最后了isOK   " + str(isOKFlag))
    except:
        print("异常了   ")
        break

# 8.6 选择取货零售店 【此处我选择了-Apple 青岛万象城】
element_pickupTab = driver.find_element_by_xpath('//*[@class="rt-storelocator-store-list"]/fieldset/ul/li[1]/input')
driver.execute_script("arguments[0].click();", element_pickupTab)
driver.implicitly_wait(20)

# 8.7 继续填写取货详情
element_checkout = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_checkout)
time.sleep(2)

# 8.8 选择取货时间 【根据时间自己定】
element_pickup_time = driver.find_element_by_xpath(
    '//*[@value="18"]')
driver.execute_script("arguments[0].click();", element_pickup_time)
time.sleep(2)

# 8.9 选择取货时间段 【此处我选择了-默认第一个时间段】
element_time_quantum = driver.find_element_by_xpath(
    '//*[@id="checkout.fulfillment.pickupTab.pickup.timeSlot.dateTimeSlots.timeSlotValue"]')
Select(element_time_quantum).select_by_index(1)
time.sleep(2)

# 8.10 继续填写取货详情
element_checkout = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.implicitly_wait(15)
driver.execute_script("arguments[0].click();", element_checkout)
element_checkout.click()
driver.implicitly_wait(20)

# 9.1 请填写姓氏
lastName = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.lastName')
lastName.send_keys('胡')
driver.implicitly_wait(10)

# 9.2 请填写名字
firstName = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.firstName')
firstName.send_keys('东旭')
driver.implicitly_wait(10)

# 9.3 请填写电子邮件
emailAddress = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.emailAddress')
emailAddress.send_keys('862422627@qq.com')
driver.implicitly_wait(10)

# 9.4 请填写手机号
emailAddress = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.selfContact.address.fullDaytimePhone')
emailAddress.send_keys('18306390693')
driver.implicitly_wait(10)

# 9.5 请填写身份证后四位
nationalIdSelf = driver.find_element_by_id(
    'checkout.pickupContact.selfPickupContact.nationalIdSelf.nationalIdSelf')
nationalIdSelf.send_keys('403X')
driver.implicitly_wait(10)

# 9.6 继续选择付款方式
element_checkoutPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_checkoutPay)
driver.implicitly_wait(10)

# 10 立即下单 【此处我选择了-微信支付】
element_billingOptions = driver.find_element_by_id(
    'checkout.billing.billingoptions.wechat_label')
driver.execute_script("arguments[0].click();", element_billingOptions)
driver.implicitly_wait(10)

# 11.1 确定
element_orderPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_orderPay)
time.sleep(2)

# 12 确认订单
element_endPay = driver.find_element_by_id(
    'rs-checkout-continue-button-bottom')
driver.execute_script("arguments[0].click();", element_endPay)
driver.implicitly_wait(15)

# 11 退出浏览器
time.sleep(10)
# driver.quit()

print("iphone14-pro 自动化测试结束")

订阅有货通知

为了更便于大家进行抢购,特提供邮箱订阅有货功能

作用

1.本狗已将14 pro/max所有型号扒下,大家可以选择心怡的产品进行订阅。
2.服务器会24小时不间断调用苹果接口,实时监控有货,一旦有货立马通知订阅邮箱

地址

http://apple.javadog.net/apple/v1/

操作

1.测试邮箱是否可以接受邮件,输入自己邮箱,点击发送,记得不要忽略加入黑名单

2.选择自己心仪型号及取货位置,并录入自己接受邮件的邮箱即可,如有货即可推送邮件

3.接到邮件手速快的同学,机会很大呦

总结

希望大家理性使用及购买,本人也当娱乐学习,拖更也真诚的跟大家道个歉,希望大家可去踩踩我的狗窝😄


评论