Advertisement
Guest User

Untitled

a guest
Sep 29th, 2019
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. from selenium import webdriver
  2. from bs4 import BeautifulSoup
  3.  
  4. browser = webdriver.Chrome('/Users/kenny/MEGA/Python/chromedriver')
  5. browser.get('https://www.ebay.com/itm/Invicta-Mens-Watch-Pro-Diver-Quartz-Black-Dial-Dive-Quartz-Bracelet-8932OB/331897627367?epid=222453104&hash=item4d46a3e2e7:g:moYAAOSwvNhdE81c')
  6. bs = BeautifulSoup(browser.page_source, 'lxml')
  7. browser.maximize_window()
  8.  
  9. title_selenium = browser.find_element_by_xpath('//*[@id="itemTitle"]').text
  10. title_BeautifulSoup = bs.find('h1', {'id': 'itemTitle'}).contents
  11.  
  12. price_selenium = browser.find_element_by_xpath('//*[@id="prcIsum"]').text.strip().split()
  13. price_BeautifulSoup = bs.find("span", {"id": "prcIsum"}).text
  14.  
  15. total_sold_selenium = browser.find_element_by_xpath('//*[@id="mainContent"]/form/div[1]/div[4]/div[2]/div/span[3]').text
  16. total_sold_price_BeautifulSoup = bs.find('span', {'class': 'vi-qtyS-hot-red'}).text
  17.  
  18. print("title_selenium", ": ", title_selenium)
  19. print("title_BeautifulSoup", ": ", title_BeautifulSoup[1],"\n")
  20. print("price_selenium", ": ", price_selenium)
  21. print("price_BeautifulSoup", ": ", BeautifulSoup,"\n")
  22. print("total_sold_sel_version", ": ", total_sold_selenium)
  23. print("total_sold_bs_version", ": ", total_sold_price_BeautifulSoup,"\n")
  24.  
  25.  
  26. browser.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement