Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Instagramlogin Error (Selenium)
#1
I tried to make a python program that can (should) login into Instagram. Here's the code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

# Login Data Example001:

#[email protected]
#[email protected]
#subbot001ccom
#[email protected]



class InstagramBot:

    def __init__(self, username, password):
        self.username = username
        self.password = password
        self.driver = webdriver.Firefox()

    def closeBrowser(self):
        self.driver.close()

    def login(self):
        driver = self.driver
        driver.get("https://www.instagram.com/")
        time.sleep(2)
        login_button = driver.find_element_by_xpath("//a[@href='/accounts/login/']")
        login_button.click()
        time.sleep(2)
        user_name_elem = driver.find_element_by_xpath("//input[@name='username']")
        user_name_elem.clear()
        user_name_elem.send_keys(self.username)
        password_elem = driver.find_element_by_xpath("//input[@name='password']")
        password_elem.clear()
        password_elem.send_keys(self.password)
        password_elem.send_keys(Keys.RETURN)


example001 = InstagramBot("[email protected]", "[email protected]")
example001.login()
When i try to run it, it manages to open the front page of Instagram, but it produces the following error:
Error:
C:\Users\Julian\PycharmProjects\ib\venv\Scripts\python.exe C:/Users/Julian/PycharmProjects/ib/ibo1.py Traceback (most recent call last): File "C:/Users/Julian/PycharmProjects/ib/ibo1.py", line 41, in <module> example001.login() File "C:/Users/Julian/PycharmProjects/ib/ibo1.py", line 26, in login driver.get("https://www.instagram.com/") File "C:\Users\Julian\PycharmProjects\ib\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get self.execute(Command.GET, {'url': url}) File "C:\Users\Julian\PycharmProjects\ib\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\Julian\PycharmProjects\ib\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=dnsNotFound&u=https%3A//www.instagram.com/&c=UTF-8&f=regular&d=Die%20Verbindung%20mit%20dem%20Server%20www.instagram.com%20schlug%20fehl. Process finished with exit code 1
I recently tried to login into Instagram, with an test account using Pycharm and then that Error occured. I tried to fix it, but it still doesn't work like it should. The program is able to open the Instagram front page, but there it stops and that error occours. I followed this youtube Tutorial to make this: https://www.youtube.com/watch?v=BGU2X5lrz9M
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium weird error julio2000 0 1,646 Feb-23-2020, 01:24 PM
Last Post: julio2000
  Selenium webdriver error WiPi 4 11,981 Feb-09-2020, 11:38 AM
Last Post: WiPi
  error when running headless selenium julio2000 2 4,508 Feb-01-2020, 12:41 PM
Last Post: julio2000
  Error clicking button with selenium julio2000 4 5,249 Jan-06-2020, 10:59 AM
Last Post: julio2000
  Selenium error with ebdriver (geckodriver) Martinelli 4 4,663 Sep-24-2019, 01:40 AM
Last Post: Martinelli
  Python Selenium .click() Loads Error - Works Manually.- Events not Triggered NSearch 24 11,521 Aug-14-2019, 02:23 PM
Last Post: NSearch
  Error when trying to use Selenium ejected 1 5,143 Mar-26-2019, 04:53 AM
Last Post: ejected
  selenium error : evilcode1 7 5,093 Nov-12-2018, 01:08 PM
Last Post: snippsat
  Getting error when accessing elements in a modal window of an webpage using selenium sumandas89 3 8,572 Jul-13-2018, 10:44 AM
Last Post: mlieqo
  Python 3/selenium - nontype error water_fox 2 11,745 Jun-28-2018, 08:19 PM
Last Post: Sudhakar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020