# Handle Firefox Not Responding While Using Selenium WebDriver With Python?

SeleniumAutomation TestingTesting Tools

We can handle the situation in which the Firefox is not responding with the help of the Selenium webdriver in Python. This can be achieved with the help of the FirefoxProfile class.

We shall create an object of this class and apply the set_preference method on it. Then pass these preferences − dom.max_script_run_time and dom.max_chrome_script_run_time with their values set to 0 as parameters to that method.

Finally, this information shall be sent to the webdriver object.

## Syntax

f = webdriver.FirefoxProfile()
f.set_preference("dom.max_chrome_script_run_time", 0)
f.set_preference("dom.max_script_run_time", 0)

We can get the above parameters of the browser by following the below steps −

• Open the Firefox browser.

• Enter dom.max_ in the search bar.

## Example

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
#object of FirefoxProfile class
f = webdriver.FirefoxProfile()
#configure preferences
f.set_preference("dom.max_chrome_script_run_time", 0)
f.set_preference("dom.max_script_run_time", 0)
#set geckodriver.exe path
driver = webdriver.Firefox(executable_path="C:\\geckodriver.exe",
firefox_profile=f)
#maximize browser
driver.maximize_window()
#launch URL
driver.get("https://www.tutorialspoint.com/index.htm")

## Output

Once the browser is opened by Selenium, we can open another tab and enter about:config to check the parameters − dom.max_script_run_time and dom.max_chrome_script_run_time. Their values shall be set to 0.

Published on 02-Feb-2021 12:18:52