
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Handle Firefox Not Responding with Selenium WebDriver in Python
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.
Type about:config in browser address.
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.