This is my code:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.options import Options
print("Openning Browser")
fp = webdriver.FirefoxProfile("C:/Users/myname/AppData/Roaming/Mozilla/Firefox/Profiles/qljcimja.whatsapp_riddle_bot")
fo = Options()
fo.add_argument("-profile")
fo.add_argument("C:/Users/myname/AppData/Roaming/Mozilla/Firefox/Profiles/qljcimja.whatsapp_riddle_bot")
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
main_win = webdriver.Firefox(fp, executable_path='C:/Drivers/geckodriver-v0.29.1-win64/geckodriver.exe', capabilities=firefox_capabilities, firefox_options=fo)
print("Done Openning Browser\nStarting Website")
main_win.get('https://web.whatsapp.com')
...
There is a lot more code into this but i am really sure the error is from the above block of code. So when i run my code it prints Openning Browser
as usual in the terminal but after the window opens it still doesnt open the url after some waiting like around 30 secs it pops an error as below
(.venv) PS E:\Nayan,s file\PythonProjects\whatsapp riddle bot> python launcher.py
Openning Browser
Traceback (most recent call last):
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\launcher.py", line 3, in <module>
main.main()
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\main.py", line 75, in main
main_win = webdriver.Firefox(fp, executable_path='C:/Drivers/geckodriver-v0.29.1-win64/geckodriver.exe', capabilities=firefox_capabilities, firefox_options=fo)
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\.venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
RemoteWebDriver.__init__(
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "E:\Nayan,s file\PythonProjects\whatsapp riddle bot\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: No connection could be made because the target machine actively refused it. (os error 10061)
Yes its a riddle bot i made for my friends and ignore all the folder names
so i was curios and removed fo
, fp
and firefox_capabilities
variables and ran the driver with only the driver_path variable and it ran.
But i want the profile to be loaded cause i always have to take my phone to scan the code to get whatsapp web running, imagine while i am testing everytime i have to scan again and again.
In short i wanna know why this is happening(like is it a bug in selenium or anything) and is there way to workaround?