Created
March 22, 2017 13:10
-
-
Save dthtien/f05c86fa2e1e34bf533788c6d18b60b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'watir' | |
browser = Watir::Browser.new :chrome | |
browser.goto('https://m.adidas.com/us/myaccount') | |
browser_iframe = browser.iframe(id: 'loginaccountframe') | |
browser_iframe.text_field(id: 'username').set('[email protected]') | |
browser_iframe.text_field(name: 'password').set('09042015a') | |
browser_iframe.send_keys :enter | |
Watir::Wait.until { browser.text.include? 'Logout' } | |
browser.goto('http://www.adidas.com/us/ultraboost-shoes/BA7686.html') | |
browser.select_list(css: '#size-select-BA7686').select_value('BA7686_610') | |
browser.button(name: 'add-to-card-button').click | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
require 'watir'
product_url = 'http://www.adidas.com/us/stan-smith-shoes/B24105.html'
browser = Watir::Browser.new :chrome
browser.goto('https://m.adidas.com/us/myaccount')
browser_iframe = browser.iframe(id: 'loginaccountframe')
browser_iframe.text_field(id: 'username').set('[email protected]')
browser_iframe.text_field(name: 'password').set('09042015a')
browser_iframe.send_keys :enter
Watir::Wait.until { browser.text.include? 'Logout' }
browser.goto(product_url)
browser.link(css: '.ffSelectButton').click
browser.element(css: '.ffSelectMenuMid li:nth-child(3)').click
browser.button(name: 'add-to-cart-button').click
sleep(20)
browser.quit