0

I was testing a program that I found to open instagram in firefox using selenium.

from time import sleep
from selenium import webdriver

browser = webdriver.Firefox()

browser.get('https://www.instagram.com/')

sleep(5)

browser.close()

In theory the program should work but I get the error: selenium.common.exceptions.TimeoutException: Message: A connection cannot be established as the target computer expressly denied said connection. (os error 10061). Does anyone know what the problem is?

Aran
  • 1
  • Is the website accessible from your browser? The above code works fine for me. – PApostol Apr 03 '21 at 10:34
  • Yes, manually if it let me – Aran Apr 03 '21 at 11:18
  • may be a proxy or a firewall which might be blocking – Ajay Apr 03 '21 at 11:21
  • Most likely you have closed the browser window, and tried to run part of te script after that.Also try to specify path and make sure you see a shell open and browser after that (does the browser open?). from selenium import webdriver geckodriver = r'geckodriver.exe' driver = webdriver.Firefox(executable_path=geckodriver) print('Selenium webdriver setup complete') for x in range(2): driver.get('https://www.google.com') driver.save_screenshot('data/WorkArea/image{}.png'.format(x)) print('Took screenshot {}'.format(x)) driver.quit() – karel van dongen Apr 03 '21 at 11:49
  • https://stackoverflow.com/questions/2972600/no-connection-could-be-made-because-the-target-machine-actively-refused-it – vitaliis Apr 03 '21 at 15:02

0 Answers0