0

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.

AppleCider
  • 23
  • 5
  • 1
    Possible duplicate of http://stackoverflow.com/questions/20485360/selenium-with-pyvirtualdisplay-unable-to-locate-element – saurabh baid Nov 18 '16 at 06:37

2 Answers2

1

Well, your URL is not wrapped in quotes. I'd bet that is your problem.

Change

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

to

url = "https://finance.yahoo.com/quote/GOOG?ltr=1"
ddavison
  • 28,221
  • 15
  • 85
  • 110
0

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.

AppleCider
  • 23
  • 5