Guest User

Untitled

a guest
Sep 15th, 2019
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from selenium import webdriver
  2.  
  3.  
  4. name = [] # Array for channel names
  5. link = [] # Array for channel links
  6. logo = [] # Array fpr channel logos
  7.  
  8.  
  9. # Chrome driver path and background option
  10. options = webdriver.ChromeOptions()
  11. options.add_argument('headless')
  12. chrome_path = r'C:\Users\aleex\Desktop\driver\chromedriver.exe'
  13. driver = webdriver.Chrome(chrome_path,options=options)
  14. driver.get('https://www.ontvtonight.com/ie/guide/')
  15.  
  16. # Increment for array assigment
  17. j = 0
  18.  
  19.  
  20. # Loop for finding web elements
  21. for i in driver.find_elements_by_class_name('channelname'):
  22. split = i.text.split('\n')[0]
  23. href = driver.find_element_by_link_text(split)
  24. name.append(split)
  25. link.append(href.get_attribute('href'))
  26. print(name[j])
  27. print(link[j])
  28. j = j + 1
  29.  
  30.  
  31. #Closing the chrome driver
  32. driver.quit()
RAW Paste Data