def faded_short_sleeve_t_shirts_compare(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find first to compare button compare_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[3]/div[2]/a' ))) # Click on add to compare button compare_button.click() time.sleep(1) # Find second to compare button compare_button_2 = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[2]/div/div/div[3]/div/div[3]/div[2]/a' ))) # Click on add to compare button compare_button_2.click() time.sleep(1) # Find COMPARE button compare_two = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/div[3]/div[2]/form/button'))) # Click on COMPARE button compare_two.click() time.sleep(1)
def faded_short_sleeve_t_shirts_more_add_to_wishlist(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button more_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[2]/a[2]/span' ))) # Click on button more_button.click() time.sleep(1) # Find Add to wishlist button add_to_wishlist = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="wishlist_button"]'))) # Click on add to wishlist add_to_wishlist.click() time.sleep(2) # Find close button (x) of the popup popup_close = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/a'))) # Close the popup popup_close.click() time.sleep(1)
def faded_short_sleeve_t_shirts_more_quantity_decrease(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button more_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[2]/a[2]/span' ))) # Click on button more_button.click() time.sleep(1) # Find QUANTITY and wait for it to be clickable decrease_quantity = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="quantity_wanted_p"]/a[1]/span'))) # Click on - sign one(1) time(s) to decrease quantity decrease_quantity.click() time.sleep(1)
def faded_short_sleeve_t_shirts_more_size_medium(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button more_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[2]/a[2]/span' ))) # Click on button more_button.click() time.sleep(1) # Find SIZE dropdown and wait for it to be clickable size_large = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="group_1"]/option[2]'))) # Select the size M and click it size_large.click() time.sleep(1)
def contact_us(): site_login() # Find WOMEN link in navbar and wait for it to be clickable contact = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="contact-link"]/a'))) # Click on WOMEN in navbar contact.click() # Find Subject Heading and wait for it to be clickable subject_heading = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="id_contact"]/option[2]'))) # Click on subject heading and select Customer Service subject_heading.click() # Find Order reference and wait for it to be clickable order_reference = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/form/fieldset/div[1]/div[1]/div[2]/div/select/option[2]' ))) # Click on order reference and select first on the list order_reference.click() # Find Product and wait for it to be clickable product = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="253601_order_products"]/option[2]'))) # Click on Product and select the first product on list product.click() # Find Attach File and wait for it to be clickable # attach_file = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="fileUpload"]'))) # Click on attach file # attach_file.click() # Upload file an locate it on you drive # attach_file.send_keys('/Users/nikolarancnik/Downloads/IN027828.pdf') # Find Message Textbox and wait for it to be clickable message = wait.until(EC.element_to_be_clickable((By.ID, 'message'))) # Click on message textbox message.click() # Type in message you want to write message.send_keys("This is the message I want to write in textbox") # Find SEND button and wait for it to be clickable send = wait.until(EC.element_to_be_clickable((By.ID, 'submitMessage'))) # Click SEND button send.click()
def buy_blouse(): site_login() # Find WOMEN link in navbar and wait for it to be clickable women = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() # Find TOPS link in navbar and wait for it to be clickable tops = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="subcategories"]/ul/li[1]/div[1]/a'))) # Click on TOPS tops.click() # Find BLOUSES and wait for it to be clickable blouses = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="subcategories"]/ul/li[2]/div[1]/a'))) # Click on BLOUSES blouses.click() # Find LIST button to change view of products wait for it to be clickable list_view = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() # Find ADD TO CART button and wait for it to be clickable add_to_cart = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="center_column"]/ul/li/div/div/div[3]/div/div[2]/a[1]'))) # Click ADD TO CART button add_to_cart.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_1 = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/a'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_1.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_2 = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="center_column"]/p[2]/a[1]'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_2.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_3 = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="center_column"]/form/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_3.click() # Find Terms of service checkbox and wait for it to be clickable terms_of_service = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="uniform-cgv"]/span'))) # Agree on Terms of service terms_of_service.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_4 = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="form"]/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_4.click() # Find PAY WITH BANK WIRE button and wait for it to be clickable pay_with_bank_wire = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="HOOK_PAYMENT"]/div[1]/div/p/a'))) # Click PAY WITH BANK WIRE pay_with_bank_wire.click() # Find I CONFIRM MY ORDER button and wait for it to be clickable confirm_order = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="cart_navigation"]/button/span'))) # Click PAY WITH BANK WIRE confirm_order.click()
def buy_tshirt(): site_login() # Find T-SHIRTS link in navbar and wait for it to be clickable t_shirts = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[3]/a'))) # Click T-SHIRTS button t_shirts.click() # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() # Find ADD TO CART button and wait for it to be clickable add_to_cart = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/ul/li/div/div/div[3]/div/div[2]/a[1]'))) # Click ADD TO CART button add_to_cart.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_1 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/a'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_1.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/p[2]/a[1]'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_2.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_3 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/form/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_3.click() # Find Terms of service checkbox and wait for it to be clickable terms_of_service = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="uniform-cgv"]/span'))) # Agree on Terms of service terms_of_service.click() # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_4 = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="form"]/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_4.click() # Find PAY BY CHECK button and wait for it to be clickable pay_by_check = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="HOOK_PAYMENT"]/div[2]/div/p/a'))) # Click PAY BY CHECK pay_by_check.click() # Find I CONFIRM MY ORDER button and wait for it to be clickable confirm_order = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="cart_navigation"]/button/span'))) # Click PAY WITH BANK WIRE confirm_order.click()
def faded_short_sleeve_t_shirts_more_write_a_review(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button more_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[2]/a[2]/span' ))) # Click on button more_button.click() time.sleep(1) # Find WRITE A REVIEW textbox and wait for it to be clickable write_a_review_blouse = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product_comments_block_extra"]/ul/li/a'))) # Click on WRITE A REVIEW write_a_review_blouse.click() time.sleep(1) # Find QUALITY stars and wait for it to be clickable quality_star_5 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="criterions_list"]/li/div[1]/div[6]'))) # Click and rate the product with 5 stars quality_star_5.click() time.sleep(1) # Find TITLE input field for blouse and wait for it to be clickable review_blouse_title = wait.until( EC.element_to_be_clickable((By.NAME, 'title'))) # Click on TITLE input field review_blouse_title.click() # Type in title review_blouse_title.send_keys("Title for blouse") time.sleep(1) # Find COMMENT input field for blouse and wait for it to be clickable review_blouse_comment = wait.until( EC.element_to_be_clickable((By.NAME, 'content'))) # Click on COMMENT input field review_blouse_comment.click() # Type in COMMENT review_blouse_comment.send_keys( "One big comment for blouse that is automated") time.sleep(1) # Find SEND button and wait for it to be clickable send_review = wait.until( EC.element_to_be_clickable((By.ID, 'submitNewMessage'))) # Click SEND to send a review send_review.click() time.sleep(1) # Find OK button and wait for it to be clickable ok_button_review = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/div/p[2]/button'))) # Click OK button ok_button_review.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="add_to_cart"]/button'))) # Click ADD TO CART button add_to_cart.click() time.sleep(1) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/a/span'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout.click() time.sleep(1) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/p[2]/a[1]/span'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_2.click() time.sleep(1) # Find TEXTAREA # "If you would like to add a comment about your order, please write in the field below order_comment = wait.until(EC.element_to_be_clickable( (By.NAME, 'message'))) # Click to write into textbox order_comment.click() # Pause for 1 second time.sleep(1) # Write your comment about order order_comment.send_keys("This is my comment about this order") time.sleep(1) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/form/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_2.click() time.sleep(1) # Find text link "(Read the Terms of Service)" read_terms_of_service = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="form"]/div/p[2]/a'))) # Click to read terms of service read_terms_of_service.click() time.sleep(3) # Find close button (x) for window of "terms and conditions of use" close_terms_of_service = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="order"]/div[2]/div/div/a'))) # Close the window of terms of service close_terms_of_service.click() time.sleep(1) # Find Terms of service checkbox and wait for it to be clickable terms_of_service = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="uniform-cgv"]/span'))) # Agree\Click on Terms of service terms_of_service.click() time.sleep(2) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_3 = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="form"]/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_3.click() time.sleep(1) # Find PAY WITH BANK WIRE button and wait for it to be clickable pay_with_bank_wire = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="HOOK_PAYMENT"]/div[1]/div/p/a'))) # Click PAY WITH BANK WIRE pay_with_bank_wire.click() time.sleep(1) # Find I CONFIRM MY ORDER button and wait for it to be clickable confirm_order = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="cart_navigation"]/button'))) # Click PAY WITH BANK WIRE confirm_order.click() time.sleep(1)
def faded_short_sleeve_t_shirts_blue_color(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find BLUE color and wait for it to be clickable blue_color = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="color_2"]'))) # Click on BLUE color blue_color.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="add_to_cart"]/button'))) # Click ADD TO CART button add_to_cart.click() time.sleep(1) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/a/span'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout.click() time.sleep(1) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/p[2]/a[1]/span'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_2.click() time.sleep(1) # Find TEXTAREA # "If you would like to add a comment about your order, please write in the field below order_comment = wait.until(EC.element_to_be_clickable( (By.NAME, 'message'))) # Click to write into textbox order_comment.click() # Pause for 1 second time.sleep(1) # Write your comment about order order_comment.send_keys("This is my comment about this order") time.sleep(1) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/form/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_2.click() time.sleep(1) # Find text link "(Read the Terms of Service)" read_terms_of_service = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="form"]/div/p[2]/a'))) # Click to read terms of service read_terms_of_service.click() time.sleep(3) # Find close button (x) for window of "terms and conditions of use" close_terms_of_service = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="order"]/div[2]/div/div/a'))) # Close the window of terms of service close_terms_of_service.click() time.sleep(1) # Find Terms of service checkbox and wait for it to be clickable terms_of_service = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="uniform-cgv"]/span'))) # Agree\Click on Terms of service terms_of_service.click() time.sleep(2) # Find PROCEED TO CHECKOUT button and wait for it to be clickable proceed_to_checkout_3 = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="form"]/p/button'))) # Click PROCEED TO CHECKOUT button proceed_to_checkout_3.click() time.sleep(1) # Find PAY WITH BANK WIRE button and wait for it to be clickable pay_with_bank_wire = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="HOOK_PAYMENT"]/div[1]/div/p/a'))) # Click PAY WITH BANK WIRE pay_with_bank_wire.click() time.sleep(1) # Find I CONFIRM MY ORDER button and wait for it to be clickable confirm_order = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="cart_navigation"]/button'))) # Click PAY WITH BANK WIRE confirm_order.click() time.sleep(1)
def faded_short_sleeve_t_shirts_more_view_larger_swipe_left(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button more_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[2]/a[2]/span' ))) # Click on button more_button.click() time.sleep(1) # Find VIEW LARGE button to see the picture in full size view_large_picture = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="view_full_size"]'))) # Click on picture VIEW LARGE button view_large_picture.click() time.sleep(1) # Find PREVIOUS button previous_button = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div[1]/a[1]'))) # Click PREVIOUS button to see the next image previous_button.click() time.sleep(2) # Find PREVIOUS button 2 previous_button_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/div[1]/a[1]'))) # Click PREVIOUS button 2 to see the next image previous_button_2.click() time.sleep(2) # Find PREVIOUS button 3 previous_button_3 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/div[1]/a[1]'))) # Click PREVIOUS button 3 to see the next image previous_button_3.click() time.sleep(2) # Find PREVIOUS button 4 previous_button_4 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/div[1]/a[1]'))) # Click PREVIOUS button 4 to see the next image previous_button_4.click() time.sleep(2) # Find CLOSE button (x) to close the large picture close_large = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/a'))) # Click to close the window close_large.click()
def faded_short_sleeve_t_shirts_more_send_to_a_friend(): driver.maximize_window() # Log in into website site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button more_button = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[2]/a[2]/span' ))) # Click on button more_button.click() time.sleep(1) # Find SEND TO A FRIEND button send_to_a_friend_button = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="send_friend_button"]'))) # Click SEND TO A FRIEND button send_to_a_friend_button.click() time.sleep(1) # Find NAME OF YOUR FRIEND input field name_of_your_friend = wait.until( EC.element_to_be_clickable((By.NAME, 'friend_name'))) # Click to write into input field name_of_your_friend.click() # Write your friend's name about order name_of_your_friend.send_keys("Jane Doe") time.sleep(2) # Find EMAIL ADDRESS OF YOUR FRIEND input field email_of_your_friend = wait.until( EC.element_to_be_clickable((By.NAME, 'friend_email'))) # Click to write into input field email_of_your_friend.click() # Write your friend's email email_of_your_friend.send_keys("*****@*****.**") time.sleep(2) # Find SEND button send_button_friend = wait.until( EC.element_to_be_clickable((By.NAME, 'sendEmail'))) # Click SEND button to send content to friend send_button_friend.click() time.sleep(2) # Find OK button friend_ok = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/div/p[2]/input'))) # Click OK button friend_ok.click() time.sleep(1)
def change_personal_info(): site_login() # Find MY PERSONAL INFORMATION and wait for it to be clickable my_personal_information = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/div/div[1]/ul/li[4]/a/span'))) # Click on MY PERSONAL INFORMATION my_personal_information.click() # Find First name field and wait for it to be clickable firstname = wait.until(EC.element_to_be_clickable((By.ID, 'firstname'))) # Clear firstname filed firstname.clear() # Click on firstname field firstname.click() # Type in firstname field firstname.send_keys("Nikola") # Find Last name field and wait for it to be clickable lastname = wait.until(EC.element_to_be_clickable((By.ID, 'lastname'))) # Clear lastname filed lastname.clear() # Click on lastname field lastname.click() # Type in lastname field lastname.send_keys("Rancnik") # Find E-mail address field and clear it email = wait.until(EC.element_to_be_clickable((By.ID, 'email'))) # Clear lastname filed email.clear() # Click on lastname field email.click() # Type in lastname field email.send_keys("*****@*****.**") # Find Date of birth field set day to 1 days = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="days"]/option[2]'))) days.click() # Find Date of birth field set month to January month = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="months"]/option[2]'))) month.click() # Find Date of birth field set month to January year = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="years"]/option[22]'))) year.click() # Find Current Password field and click it old_pass = wait.until(EC.element_to_be_clickable((By.ID, 'old_passwd'))) old_pass.click() # Type in current user password old_pass.send_keys("brucewayne94") # Find New Password field and click it new_pass = wait.until(EC.element_to_be_clickable((By.ID, 'passwd'))) new_pass.click() # Type in current user password new_pass.send_keys("waynebruce94") # Confirmation field and click it confirmation = wait.until( EC.element_to_be_clickable((By.ID, 'confirmation'))) confirmation.click() # Type in current user password confirmation.send_keys("waynebruce94") # Find SAVE button save_info = wait.until( EC.element_to_be_clickable((By.NAME, 'submitIdentity'))) save_info.click() # Find BACK TO YOUR ACCOUNT back_to_acc = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/ul/li[1]/a/span'))) back_to_acc.click()
def change_color(): site_login() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find LIST button to change view of products wait for it to be clickable list_view = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="list"]/a'))) # Click LIST button list_view.click() time.sleep(1) # Find MORE button in Printed Summer Dress and wait for it to be clickable more_summer_dress = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/ul/li[5]/div/div/div[3]/div/div[2]/a[2]' ))) # Click on dress more_summer_dress.click() time.sleep(1) # Find BLACK color and wait for it to be clickable black_color = wait.until(EC.element_to_be_clickable((By.NAME, 'Black'))) # Click on BLACK color black_color.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart_black = wait.until( EC.element_to_be_clickable((By.NAME, 'Submit'))) # Click on ADD TO CART button add_to_cart_black.click() time.sleep(1) # Find CONTINUE SHOPPING button and wait for it to be clickable continue_shopping_black = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/span/span'))) # Click on ADD TO CART button continue_shopping_black.click() time.sleep(1) # Find ORANGE color and wait for it to be clickable orange_color = wait.until(EC.element_to_be_clickable((By.NAME, 'Orange'))) # Click on BLACK color orange_color.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart_orange = wait.until( EC.element_to_be_clickable((By.NAME, 'Submit'))) # Click on ADD TO CART button add_to_cart_orange.click() time.sleep(1) # Find CONTINUE SHOPPING button and wait for it to be clickable continue_shopping_orange = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/span/span'))) # Click on ADD TO CART button continue_shopping_orange.click() time.sleep(1) # Find SIZE dropdown and wait for it to be clickable size_dress_medium = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="group_1"]/option[2]'))) # Select the size M and click it size_dress_medium.click() time.sleep(1) # Find BLUE color and wait for it to be clickable blue_color = wait.until(EC.element_to_be_clickable((By.NAME, 'Blue'))) # Click on BLACK color blue_color.click() time.sleep(1) # Find QUANTITY and wait for it to be clickable dress_quantity_blue = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="quantity_wanted_p"]/a[2]'))) # Click on + sign to increase quantity to 2 dress_quantity_blue.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart_blue = wait.until( EC.element_to_be_clickable((By.NAME, 'Submit'))) # Click on ADD TO CART button add_to_cart_blue.click() time.sleep(1) # Find CONTINUE SHOPPING button and wait for it to be clickable continue_shopping_blue = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/span/span'))) # Click on ADD TO CART button continue_shopping_blue.click() time.sleep(1) # Find YELLOW color and wait for it to be clickable yellow_color = wait.until(EC.element_to_be_clickable((By.NAME, 'Yellow'))) # Click on BLACK color yellow_color.click() time.sleep(1) # Find QUANTITY and wait for it to be clickable dress_quantity_yellow = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="quantity_wanted_p"]/a[1]'))) # Click on - sign to decrease quantity to 1 dress_quantity_yellow.click() time.sleep(1) dress_quantity_yellow.click() time.sleep(1) # Find SIZE dropdown and wait for it to be clickable size_dress_large = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="group_1"]/option[3]'))) # Select the size L and click it size_dress_large.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart_yellow = wait.until( EC.element_to_be_clickable((By.NAME, 'Submit'))) # Click on ADD TO CART button add_to_cart_yellow.click() time.sleep(1) # Find CONTINUE SHOPPING button and wait for it to be clickable continue_shopping_yellow = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/span/span'))) # Click on ADD TO CART button continue_shopping_yellow.click() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women.click() time.sleep(1) # Find ADD TO WISHLIST button and wait for it to be clickable add_to_wishlist = wait.until( EC.element_to_be_clickable(( By.XPATH, '//*[@id="center_column"]/ul/li[1]/div/div/div[3]/div/div[3]/div[1]/a' ))) # Click ADD TO WISHLIST button add_to_wishlist.click() # Now the popup will appear and say "Added to your wishlist", close it on "X" button popup_x = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="category"]/div[2]/div/div/a'))) popup_x.click() time.sleep(1) # Find MORE button in Printed Summer Dress and wait for it to be clickable more_blouse_button = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/ul/li[2]/div/div/div[3]/div/div[2]/a[2]' ))) # Click on dress more_blouse_button.click() time.sleep(1) # Find WRITE A REVIEW textbox and wait for it to be clickable write_a_review_blouse = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product_comments_block_extra"]/ul/li/a'))) # Click on WRITE A REVIEW write_a_review_blouse.click() time.sleep(1) # Find QUALITY stars and wait for it to be clickable quality_star_5 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="criterions_list"]/li/div[1]/div[6]'))) # Click and rate the product with 5 stars quality_star_5.click() time.sleep(1) # Find TITLE input field for blouse and wait for it to be clickable review_blouse_title = wait.until( EC.element_to_be_clickable((By.NAME, 'title'))) # Click on TITLE input field review_blouse_title.click() # Type in title review_blouse_title.send_keys("Title for blouse") time.sleep(1) # Find COMMENT input field for blouse and wait for it to be clickable review_blouse_comment = wait.until( EC.element_to_be_clickable((By.NAME, 'content'))) # Click on COMMENT input field review_blouse_comment.click() # Type in COMMENT review_blouse_comment.send_keys( "One big comment for blouse that is automated") time.sleep(1) # Find SEND button and wait for it to be clickable send_review = wait.until( EC.element_to_be_clickable((By.ID, 'submitNewMessage'))) # Click SEND to send a review send_review.click() time.sleep(1) # Find OK button and wait for it to be clickable ok_button_review = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="product"]/div[2]/div/div/div/p[2]/button'))) # Click OK button ok_button_review.click() time.sleep(1) # Find WOMEN link in navbar and wait for it to be clickable women_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women_2.click() time.sleep(1) # Find MORE button on PRINTED CHIFFON DRESS and wait for it to be clickable chiffon_dress_more = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="center_column"]/ul/li[7]/div/div/div[3]/div/div[2]/a[2]' ))) # Click on the image of the chiffon dress chiffon_dress_more.click() time.sleep(1) # Find QUANTITY and wait for it to be clickable chiffon_quantity = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="quantity_wanted_p"]/a[2]'))) # Click on + sign two times to increase quantity to 3 chiffon_quantity.click() time.sleep(1) chiffon_quantity.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart_chiffon = wait.until( EC.element_to_be_clickable((By.NAME, 'Submit'))) # Click on ADD TO CART button add_to_cart_chiffon.click() time.sleep(1) # Find CONTINUE SHOPPING button and wait for it to be clickable continue_shopping_chiffon = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/span/span'))) # Click on ADD TO CART button continue_shopping_chiffon.click() time.sleep(1) # Find green color and wait for it to be clickable green_color_chiffon = wait.until( EC.element_to_be_clickable((By.NAME, 'Green'))) # Click on green color green_color_chiffon.click() time.sleep(1) # Find QUANTITY and wait for it to be clickable chiffon_quantity_green = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="quantity_wanted_p"]/a[1]'))) # Click on + sign two times to increase quantity to 3 chiffon_quantity_green.click() time.sleep(1) chiffon_quantity_green.click() time.sleep(1) # Find SIZE dropdown and wait for it to be clickable size_dress_medium_chiffon = wait.until( EC.element_to_be_clickable((By.XPATH, '//*[@id="group_1"]/option[2]'))) # Select the size M and click it size_dress_medium_chiffon.click() time.sleep(1) # Find ADD TO CART button and wait for it to be clickable add_to_cart_chiffon_2 = wait.until( EC.element_to_be_clickable((By.NAME, 'Submit'))) # Click on ADD TO CART button add_to_cart_chiffon_2.click() time.sleep(1) # Find CONTINUE SHOPPING button and wait for it to be clickable continue_shopping_chiffon_2 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="layer_cart"]/div[1]/div[2]/div[4]/span/span'))) # Click on ADD TO CART button continue_shopping_chiffon_2.click() # Find WOMEN link in navbar and wait for it to be clickable women_3 = wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[@id="block_top_menu"]/ul/li[1]/a'))) # Click on WOMEN in navbar women_3.click()