S
S
Studentka19962021-08-29 17:36:17
Python
Studentka1996, 2021-08-29 17:36:17

How to write an authorization autotest in Instagram (Selenium)?

Access to Instagram stopped working:

612b9ba23463e421755352.png

Attempts with timing, server settings, Instagram, creating self-written certificates were unsuccessful.
How to fix? Authorization code:

def authorize(driver): 
    try:
        driver.get('https://www.instagram.com/') # ссылка на инстаграм с параметрами авторизации
        driver.implicitly_wait(5)
        driver.find_element_by_name("username").send_keys(' ')
        driver.find_element_by_name("password").send_keys(' ')
        driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[3]/button').click()
        sleep(5)
        driver.save_screenshot('.. .png') # для просмотра результата автотеста
        print('Успешная авторизация в инстаграм')
    except Exception as e: print(e)


 # Проверьте, существует ли текущая версия chromedriver, если нет, загрузите его автоматически, затем добавляем хромированный ключ в путь
chromedriver_autoinstaller.install()
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless") # запуск в фоновом режиме
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--ignore-certificate-errors') # самозаверяющий сертификат
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--disable-features=VizDisplayCompositor')
chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'
chrome_options.add_argument(f'user-agent={user_agent}')
driver = webdriver.Chrome(executable_path=" ", options=chrome_options)
authorize(driver) # без авторизации работает?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antonio Solo, 2021-08-30
@solotony

webdriver control is tracked without problems today.
https://developer.mozilla.org/en-US/docs/Web/API/N...
HEX editor to help;)
ps I won't say anything for Instagram, but I bypassed Google like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question