asin_list = ["B00CAJLBMK"]
url1 = "https://www.amazon.co.jp/gp/offer-listing/"
url2 = "/ref=olp_f_new?ie=UTF8&f_new=true"
for asin in asin_list:
driver.get(url1+asin+url2)
# 表示待ち
while True:
time.sleep(1)
if driver.title.find("Amazon")>-1:
break
time.sleep(5)
items = driver.find_elements_by_xpath("//div[@role='row']")
for item in items:
shop,price,kosu,kosu2="","","",""
shop = item.find_elements_by_xpath("div/h3/span/a")
if len(shop)>0:
price = item.find_elements_by_xpath("div[contains(@class,'olpPriceColumn')]/span")[0].text.replace(u"¥","").replace(",","")
kosu = item.find_elements_by_xpath("div/div/div[@id='keepaMAP']/following-sibling::b")
if len(kosu)>0:
kosu2 = kosu[0].text.replace(u"点","")
print "{0}|{1}|{2}|{3}|{4}".format(datetime.date.today(),asin,shop[0].text.encode('utf-8'),price,kosu2)
print
print
time.sleep(3)
driver.quit()