Hello guys, i'm a student and i'm douing a project for the exam.
I tried in any way possible but i can't get my code to run, whit some other sites it works, but with instagram don't. What I'm doing wrong?
I did also a "Hacker" account just to run my project, then i guess that it's not a power problem
anyway my start code is:
from pyvirtualdisplay import Display
from selenium import webdriver
from time import sleep
with Display():
browser = webdriver.Firefox()
try:
browser.get('https://www.instagram.com')
print("get instagram.com ")
browser.implicitly_wait(60)
browser.find_element_by_link_text('Log in').click()
print("click log in")
sleep(10)
finally:
browser.quit()
the error seems because it can't fine the element but I'm sure that my code works
get instagram.com
Traceback (most recent call last):
File "/home/fobu36/.virtualenvs/prova_selenium.py", line 16, in <module>
browser.find_element_by_link_text('Log in').click()
File "/home/fobu36/.local/lib/python3.6/site-
packages/selenium/webdriver/remote/webdriver.py", l
ine 317, in find_element_by_link_text
return self.find_element(by=By.LINK_TEXT, value=link_text)
File "/home/fobu36/.local/lib/python3.6/site-
packages/selenium/webdriver/remote/webdriver.py", l
ine 752, in find_element
'value': value})['value']
File "/home/fobu36/.local/lib/python3.6/site-
packages/selenium/webdriver/remote/webdriver.py", l
ine 236, in execute
self.error_handler.check_response(response)
File "/home/fobu36/.local/lib/python3.6/site-
packages/selenium/webdriver/remote/errorhandler.py"
, line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate
element: {"method":"l
ink text","selector":"Log in"}
Stacktrace:
at FirefoxDriver.findElementInternal_
(file:///tmp/tmpbydkaxfk/extensions/fxdriver@googlecode.
com/components/driver-component.js:10770)
at fxdriver.Timer.setTimeout/<.notify
(file:///tmp/tmpbydkaxfk/extensions/fxdriver@googlecode.
com/components/driver-component.js:625)