Two main things to note:
- to avoid synchronization problems, you need to โseeโ explicitly in your script - expecting the elements to be visible or present before proceeding with the next steps.
- this flag can and should be clicked by clicking on the entire
label element containing input and other auxiliary elements
Here is the complete code:
from splinter import Browser browser = Browser("chrome") browser.visit("http://www.supremenewyork.com/shop/accessories/wau85w4km/cxv3ybp1w") browser.wait_time = 10 try: browser.is_element_visible_by_css("input[name=commit]", 10) browser.find_by_css("input[name=commit]").first.click() browser.is_element_visible_by_css("a.checkout", 10) browser.find_by_css("a.checkout").first.click() browser.is_element_present_by_css("label.terms", 10) browser.find_by_css('label.terms').click() finally: browser.quit()
Here is the working code that goes to the main page, goes to the third product in the scroller, adds it to the basket, checks and accepts the terms of use, time.sleep() at the end is just the result for you:
from splinter import Browser browser = Browser("chrome") browser.visit("http://www.supremenewyork.com/shop") browser.wait_time = 10 try:
source share