I'm trying to use Selenium to pull the stock symbols from this page and insert them into a list: https://www.barchart.com/stocks/highs-lows/highs?timeFrame=1y
My code:
StockList = []
driver = webdriver.Chrome()
url = "https://www.barchart.com/stocks/highs-lows/highs?timeFrame=1y"
driver.get(url)
stock_list = driver.find_elements_by_tag_name("tr")
for stock in stock_list:
stock.find_element_by_name("data-current-symbol=")
print(stock)
I receive a NoSuchElementException.
When I inspect the page, each tr has the following: "data-current-symbol="ACY
How can I pull out the stock symbol?
=should not be there ininstock.find_element_by_name("data-current-symbol=")=and changed tostock.find_element_by_name("data-current-symbol")- it didn't work.