What's new

Help Try lang..

Sure, here's a sample script for Shopee checkout:

Code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

# initialize the webdriver
driver = webdriver.Chrome()

# navigate to the Shopee checkout page
driver.get("https://shopee.ph/cart")

# wait for the page to load
time.sleep(5)

# fill in the login form
username = driver.find_element_by_name("loginKey")
username.send_keys("your_username")

password = driver.find_element_by_name("password")
password.send_keys("your_password")

password.send_keys(Keys.RETURN)

# wait for the page to load
time.sleep(5)

# navigate to the checkout page
checkout_button = driver.find_element_by_xpath("//button[contains(text(),'Checkout')]")
checkout_button.click()

# fill in the shipping information
name = driver.find_element_by_name("name")
name.send_keys("Your Name")

address = driver.find_element_by_name("address")
address.send_keys("Your Address")

city = driver.find_element_by_name("city")
city.send_keys("Your City")

province = driver.find_element_by_name("province")
province.send_keys("Your Province")

postal_code = driver.find_element_by_name("postal_code")
postal_code.send_keys("Your Postal Code")

phone = driver.find_element_by_name("phone")
phone.send_keys("Your Phone Number")

# wait for the page to load
time.sleep(5)

# click the "Continue to Payment" button
continue_to_payment_button = driver.find_element_by_xpath("//button[contains(text(),'Continue to Payment')]")
continue_to_payment_button.click()

# select the payment method
payment_method_button = driver.find_element_by_xpath("//div[contains(@class,'payment-method__item__title') and contains(text(),'Cash on Delivery')]")
payment_method_button.click()

# wait for the page to load
time.sleep(5)

# click the "Place Order" button
place_order_button = driver.find_element_by_xpath("//button[contains(text(),'Place Order')]")
place_order_button.click()

# close the webdriver
driver.quit()

To use this script, you will need to have the Selenium Python package installed and a compatible web driver for your browser. You will also need to replace the your_username and your_password placeholders with your actual Shopee account credentials, and fill in the shipping information with your own details. Once you have done that, you can run the script and it will automatically fill in the checkout form and place the order for you.
 

Similar threads

Back
Top