How do I click the size button and add to cart using selenium web driver and python?
This is for the website below
http://store.nike.com/us/en_us/pd/dri-fit-cool-tailwind-stripe-running-shirt/pid-10739300/pgid-11072108
Please let me know if there is anything I should paste in here related to the size button.
A python example:
driver = webdriver.Firefox()
driver.get("http://store.nike.com/us/en_us/pd/dri-fit-cool-tailwind-stripe-running-shirt/pid-10739300/pgid-11072108")
driver.execute_script("document.getElementsByClassName('theClassName')[0].click()")
Please note that ('theClassName')[0]
will match the first element with theClassName
, you may need to increase the number.
To get the element by its ID, use:
driver = webdriver.Firefox()
driver.get("http://store.nike.com/us/en_us/pd/dri-fit-cool-tailwind-stripe-running-shirt/pid-10739300/pgid-11072108")
driver.execute_script("document.getElementById('theIdName').click()")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With