import os
import selenium
from selenium import webdriver
import time
browser = webdriver.Chrome()
browser.get('https://www.skysports.com/champions-league-fixtures')
time.sleep(7) #So page loads completely
teamnames = browser.find_element_by_tag("span")
print(teamnames.text)
seems find_element attribute is changed on selenium :/ i also want to find all <img on another local website ( images url ) , appreciate if you can help.
CodePudding user response:
Replace teamnames = browser.find_element_by_tag("span")
with teamnames = browser.find_element_by_tag_name("span")
CodePudding user response:
Try to find elements instead of element, because in DOM Tags are always considered multiple.
Example:
browser.find_elements_by_tag_name('span')
Also, not that it will return a list of elements you need to traverse to access properties further.