Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. from selenium import webdriver
  2. from bs4 import BeautifulSoup
  3.  
  4.  
  5. driver = webdriver.Chrome('/Users/kenny/Dropbox/Python/Web Scrapping/Others/chromedriver')
  6. driver.get('https://www.ebay.com/sch/i.html?_from=R40&_nkw=watches&_sacat=0&_pgn=1')
  7. soup = BeautifulSoup(driver.page_source, 'lxml')
  8. driver.maximize_window()
  9.  
  10.  
  11. for link in soup.find_all('a', href=True):
  12.     if 'itm' in link['href']:
  13.         print(link['href'])
  14.         driver.execute_script("window.open(link['href'])") # Unable to open new tab of each watch to scrape each listing.  
  15.  
  16. driver.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement