0

Hello to whoever is reading this. I added a driver.get() into my code and it doesn't work if you could help me out it would be amazing thank you either way.

Long story short it won't go to the link I gave it.

Code:

from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium import webdriver
import os

torexe = os.popen(
    r'C:\Users\andre\Desktop\Programs\Tor Browser\Browser\firefox.exe')
profile = FirefoxProfile(
    r'C:\Users\andre\Desktop\Programs\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default')
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
profile.set_preference("network.proxy.socks_remote_dns", False)
profile.update_preferences()
firefox_options = webdriver.FirefoxOptions()
firefox_options.binary_location = r'C:\Users\andre\Desktop\Programs\Tor Browser\Browser\geckodriver.exe'
driver = webdriver.Firefox(firefox_profile=profile, options=firefox_options,
                           executable_path=r'C:\Users\andre\Desktop\Programs\Tor Browser\Browser\geckodriver.exe')
driver.get(
    "https://www.google.com/search?client=firefox-b-1-d&q=thank+youfor+your+help")

Error:

Traceback (most recent call last):
  File "c:\Users\andre\Desktop\Python dsicord bot\tewasf.py", line 17, in <module>
    driver = webdriver.Firefox(firefox_profile=profile, options=firefox_options,
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ 
    self.start_session(capabilities, browser_profile)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 64```
ykyk
  • 69
  • 1
  • 6

1 Answers1

0

As I was reading How to connect to Tor browser using Python, I noticed that your code is basically the same. So I googled some more and found: Typically Tor listens for SOCKS connections on port 9050. Tor Browser listens on port 9150. Try changing the socket port to 9150.

Leemosh
  • 883
  • 6
  • 19
  • Thank you that is very helpful but it doesn't get me to the listed website I want to get to. – ykyk Oct 03 '21 at 19:10