selenium.common.exceptions.WebDriverException: Message: 'firefox' executable needs to be in PATH with GeckoDriver Firefox Selenium and Python

selenium.common.exceptions.WebDriverException: Message: 'firefox' executable needs to be in PATH with GeckoDriver Firefox Selenium and Python

I am trying to open Firefox with selenium,i tried

I am trying to open Firefox with selenium,i tried

from selenium import webdriver
driver=webdriver.Firefox()

But i got the following error:

selenium.common.exceptions.WebDriverException: Message: 'firefox' executable needs to be in PATH.

Selenium using Python - Geckodriver executable needs to be in PATH

I tried

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('/usr/bin/firefox')
browser = webdriver.Firefox(firefox_binary=binary)

Also tried

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = DesiredCapabilities.FIREFOX
caps['marionette'] = True
caps['binary'] = '/usr/bin/firefox'
d = webdriver.Firefox(capabilities=caps)

`but still did not work.

However, when i tried using the above code replacing the last line with

d=webdriver.Firefox(capabilities=caps,executable_path='/usr/bin/firefox') and having my Firefox closed from background it would open Firefox but I can't simply d.get("https://www.google.com") it gets stuck on Linux homepage and doesn't open anything.

After typing whereis firefox in terminal i got /usr/bin/firefox,also if it matters i use python 2.7

Note: I hope this isn't a duplicate of the above link because i tried the answers and it didn't fix it.

I installed geckodriver from github, and tried browser=webdriver.Firefox(executable_path="geckodriver") ,I have placed the driver is the same directory.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Selenium with Python

Selenium with Python

Selenium WebDriver With Python 3.x - Novice To Ninja

Selenium WebDriver With Python 3.x - Novice To Ninja

Selenium Python

Selenium Python - is one of the widely used tools used for Web Browser Automation, and offers a lot of functionality and power over a browser.