Skip to content Skip to sidebar Skip to footer

Trying To Click Continue Button On Paypal With Selenium In Python

Button: before Button: After I've tried many ways to get this working. here's what I have mainagree = WebDriverWait(driver, 15).until( EC.presence_of_element_located((By.XPATH, '

Solution 1:

Based on discussion in another thread here, let's try two different approaches for syncing and clicking the button:

agree_ctn_button = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "//div[contains(@class, 'modal-foreground-container')]//div[contains(@class, 'CheckoutButton_buttonWrapper')]//button[@id='payment-submit-btn']"))) driver.execute_script("arguments[0].scrollIntoView();", agree_ctn_button) driver.execute_script("arguments[0].click();", agree_ctn_button)

OR

agree_ctn_button = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "//div[contains(@class, 'modal-foreground-container')]//div[contains(@class, 'CheckoutButton_buttonWrapper')]//button[@id='payment-submit-btn']"))) driver.execute_script("document.getElementById('payment-submit-btn').click()")

Do either of these code snippets work?

Solution 2:

mainagree = WebDriverWait(driver, 15).until(
EC.presence_of_element_located((By.XPATH, "//button[@id='payment-submit-btn']"))
)
driver.execute_script("arguments[0].click();", mainagree)

Try the following out to click on the mainagree button. If it's in an iframe you'd get NosuchElement error.

Solution 3:

Execution screenshot

As per the given url By you I tried below xpath for Agree and continue and Selenium clicks it with click method. No Switch to frame or Javascript click is required.

//button[@type='submit'][contains(.,'Agree & Continue')]

Post a Comment for "Trying To Click Continue Button On Paypal With Selenium In Python"