Search code examples
python-3.xselenium-webdriveryahoo-finance

Using Python+Selenium to click on a link on Yahoo Finance


I'm trying to click on a link from this page using selenium webdriver in Python 3:

https://finance.yahoo.com/quote/GOOG?ltr=1

url = 'https://finance.yahoo.com/quote/GOOG?ltr=1'
display = Display(visible=0,size=(600,800))
display.start()
driver = webdriver.Firefox()
driver.get(url)
driver.find_element_by_link_text('Statistics')

The above code doesn't work using the two lines with display and throws an error about not being able to click the element. But it does work if I comment them out.


Solution

  • I've figured out why it doesn't work. The display size (600,800) was too small. Once I set the size to the maximum allowed by my monitor the element was then found.