skip to Main Content

Unable to click the "Continue to payment button" on shopify site. I have seen several similar post but most of them are for js and do not mention the spinner part of the error.

driver.find_element_by_xpath ('//*[@id="continue_button"]/svg')
<div class="content-box__row">
      <div class="radio-wrapper" data-shipping-method="shopify-Standard%20Shipping-15.00">
        <div class="radio__input">
          <input class="input-radio" data-checkout-total-shipping="$15.00" data-checkout-total-shipping-cents="1500" data-checkout-shipping-rate="$15.00" data-checkout-original-shipping-rate="$15.00" data-checkout-total-price="$94.00" data-checkout-total-price-cents="9400" data-checkout-payment-due="$94.00" data-checkout-payment-due-cents="9400" data-checkout-payment-subform="required" data-checkout-subtotal-price="$79.00" data-checkout-subtotal-price-cents="7900" data-checkout-total-taxes="$0.00" data-checkout-total-taxes-cents="0" data-checkout-multiple-shipping-rates-group="false" data-backup="shopify-Standard%20Shipping-15.00" type="radio" value="shopify-Standard%20Shipping-15.00" name="checkout[shipping_rate][id]" id="checkout_shipping_rate_id_shopify-standard20shipping-15_00" />
        </div>
        <label class="radio__label" for="checkout_shipping_rate_id_shopify-standard20shipping-15_00">
          <span class="radio__label__primary" data-shipping-method-label-title="Standard Shipping">
            Standard Shipping


          </span>
          <span class="radio__label__accessory">
            <span class="content-box__emphasis">
              $15.00
            </span>
          </span>
</label>      </div> <!-- /radio-wrapper-->
    </div>

      </div>


      </div> 
    </div> 

  </div>

  <div class="step__footer" data-step-footer>

    <button name="button" type="submit" id="continue_button" class="step__footer__continue-btn btn" aria-busy="false"><span class="btn__content" data-continue-button-content="true">Continue to payment</span><svg class="icon-svg icon-svg--size-18 btn__spinner icon-svg--spinner-button" aria-hidden="true" focusable="false"> <use xlink:href="#spinner-button" /> </svg></button>
  <a class="step__footer__previous-link" href="/18292275/checkouts/38df275516a513f1c08f6c470ef014d0?step=contact_information"><svg focusable="false" aria-hidden="true" class="icon-svg icon-svg--color-accent icon-svg--size-10 previous-link__icon" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M8 1L7 0 3 4 2 5l1 1 4 4 1-1-4-4"/></svg><span class="step__footer__previous-link-content">Return to information</span></a>
</div>

2

Answers


  1. Chosen as BEST ANSWER
    ctp = driver.find_element_by_id('continue_button')
    

    ctp.click()

    Solved this issue. I am now able to click the "Continue to Payment" button.


  2. Try this xpath :

    //span[text()='Continue to payment']/..
    

    In code :

    1. Without explicit waits :

    Code :

    driver.find_element_by_xpath("//span[text()='Continue to payment']/..").click()
    
    1. With Explicit waits :

    Code :

    wait = WebDriverWait(driver, 10)
    wait.until(EC.element_to_be_clickable((By.XPATH, "//span[text()='Continue to payment']/.."))).click()
    

    Imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    

    Update 1 :

    from selenium.webdriver.common.action_chains import ActionChains
    ActionChains(driver).move_to_element(driver.find_element_by_xpath("//span[text()='Continue to payment']/..")).click().perform()
    

    Update 2 :

    driver = webdriver.Chrome(driver_path)
    driver.maximize_window()
    driver.implicitly_wait(50)
    driver.get('https://seelbachs.com/products/sagamore-spirit-cask-strength-rye-whiskey')
    wait = WebDriverWait(driver, 50)
    
    frame_xpath = '/html/body/div[5]/div/div/div/div/iframe'
    wait = WebDriverWait(driver, 10)
    # wait until iframe appears and select iframe
    wait.until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, frame_xpath)))
    
    # select button
    xpath = '//*[@id="enter"]'
    time.sleep(2)
    element= driver.find_element_by_xpath(xpath)
    ActionChains(driver).move_to_element(element).click(element).perform()
    
    # go back to main page
    driver.get('https://seelbachs.com/products/sagamore-spirit-cask-strength-rye-whiskey')
    
    # add to cart
    atc= driver.find_element_by_xpath('//button[@class="btn product-form__cart-submit product-form__cart-submit--small"]')
    atc.click()
    
    # check out
    co= driver.find_element_by_xpath ('//*[@id="shopify-section-cart-template"]/div/form/footer/div/div[2]/input[2]')
    co.click()
    
    # enter email
    driver.find_element_by_xpath('//*[@id="checkout_email"]').send_keys('[email protected]')
    time.sleep(1)
    # enter first name
    driver.find_element_by_xpath('//*[@id="checkout_shipping_address_first_name"]').send_keys('John')
    time.sleep(1)
    # enter last name
    driver.find_element_by_xpath('//*[@id="checkout_shipping_address_last_name"]').send_keys('Smith')
    time.sleep(1)
    # enter address
    driver.find_element_by_xpath ('//*[@id="checkout_shipping_address_address1"]').send_keys('111 South Street')
    
    # enter city
    driver.find_element_by_xpath ('//*[@id="checkout_shipping_address_city"]').send_keys('Cocoa')
    
    # enter zip
    driver.find_element_by_xpath ('//*[@id="checkout_shipping_address_zip"]').send_keys('263153')
    
    # enter phone
    driver.find_element_by_xpath ('//*[@id="checkout_shipping_address_phone"]').send_keys('5555555'+ u'ue007')
    
    select = Select(wait.until(EC.visibility_of_element_located((By.ID, "checkout_shipping_address_province"))))
    select.select_by_value('UK')
    
    wait.until(EC.element_to_be_clickable((By.ID, "continue_button"))).click()
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search