Skip to content

Instantly share code, notes, and snippets.

@michaelneale
Last active August 7, 2019 11:15
Show Gist options
  • Save michaelneale/b1f6b8a93aa4e75c45e899f520a24352 to your computer and use it in GitHub Desktop.
Save michaelneale/b1f6b8a93aa4e75c45e899f520a24352 to your computer and use it in GitHub Desktop.
# need to install stuff - selenium/webdriver/firefox driver/gecko or something, I forget now.
# Just mash the keyboard until it works.
my_url='https://bws.com.au/spirits/gin'
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
driver = webdriver.Firefox(firefox_options=options)
driver.get(my_url)
products = driver.find_elements_by_class_name('productTile')
f = open("bws.csv", "w")
for product in products:
price = product.find_element_by_class_name('productTile_priceDollars')
brand = product.find_element_by_class_name('productTile_brand')
print(brand.text + " " + price.text)
f.write(brand.text + ',' + price.text + '\n')
f.close()
@michaelneale
Copy link
Author

Gordon's,39
Tanqueray,45
Gordon's,63
Gordon's,49
Bombay Sapphire,66
Edinburgh,36
Edinburgh,36
Squealing Pig,54
Windsor,32
Bombay Sapphire,60
Roku,65
Houndstooth,47
Jinzu,68
Vickers,44
Ink,82
Tanqueray,73
Greenall's,42
Four Pillars,78
Beefeater,58
Hendrick's,85
Houndstooth,36
Greenall's,46
Greenall's,34
Tanqueray,65
Bombay Sapphire,80
Gin Lane 1751,59
Opihr,7
Bombay Sapphire,65
Opihr,60
The West Winds Gin,62
23rd Street Distillery,69
Four Pillars,86
Giniversity,60
Malfy,63
Hendrick's,44
Forty Spotted,75
The Botanist,85
Malfy,63
36 Short,65
Four Pillars,88
Hendrick's,85
Gin Lane 1751,59
Tanqueray,65
Opihr,60
Houndstooth,36
,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment