|
|
@@ -5,7 +5,6 @@ from selenium import webdriver |
|
|
|
from selenium.webdriver.common.by import By |
|
|
|
|
|
|
|
def search_for_dress(driver, user_id): |
|
|
|
driver.maximize_window() |
|
|
|
url = f'https://{user_id}.cpr-akashop.com/' |
|
|
|
driver.get(url) |
|
|
|
time.sleep(1) |
|
|
@@ -23,6 +22,9 @@ def search_for_dress(driver, user_id): |
|
|
|
|
|
|
|
# Find and click on the Striped Dress search result |
|
|
|
striped_dress_link = driver.find_element(By.CSS_SELECTOR, '#post-82 > div > div > div > div.non-grid-content.alternative-layout-content > h2 > a') |
|
|
|
# Scroll to the element |
|
|
|
driver.execute_script("arguments[0].scrollIntoView(true);", striped_dress_link) |
|
|
|
time.sleep(1) # Add a small delay after scrolling |
|
|
|
striped_dress_link.click() |
|
|
|
time.sleep(3) |
|
|
|
|
|
|
@@ -36,16 +38,22 @@ def search_for_dress(driver, user_id): |
|
|
|
view_cart_button.click() |
|
|
|
time.sleep(3) |
|
|
|
|
|
|
|
# Click on Proceed to Checkout |
|
|
|
# Scroll to the Proceed to Checkout button |
|
|
|
proceed_to_checkout_button = driver.find_element(By.CSS_SELECTOR, '#content > div > div > div > div.nv-content-wrap.entry-content > div > div.cart-collaterals > div > div > a') |
|
|
|
driver.execute_script("arguments[0].scrollIntoView(true);", proceed_to_checkout_button) |
|
|
|
time.sleep(1) # Add a small delay after scrolling |
|
|
|
|
|
|
|
# Click on Proceed to Checkout |
|
|
|
proceed_to_checkout_button.click() |
|
|
|
time.sleep(3) |
|
|
|
|
|
|
|
|
|
|
|
def main(user_id): |
|
|
|
# Chrome |
|
|
|
driver = webdriver.Chrome() |
|
|
|
search_for_dress(driver, user_id) |
|
|
|
driver.quit() |
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
user_id = input("Please enter your user ID: ") |
|
|
|
user_id = input("Please enter your user ID: ") # Ask for the user ID only once |
|
|
|
|
|
|
|
# Chrome |
|
|
|
driver = webdriver.Chrome() |
|
|
|
search_for_dress(driver, user_id) |
|
|
|
main(user_id) |