Selenium - Unresponsive Script Error (Firefox)

This question has been asked before, but the answer does not seem to work for me. The problem is that when I open a page using Selenium, I get Unresponsive Script pop-ups, referring to different scripts.

When I open a page using Firefox without Selenium, I get no errors. Also, oddly enough, when I open a page using selenium manually, it works. Therefore, I can’t even identify the problem.

I can share the code, but I don’t need to do this. Essentially this happens:

  • The program collects tuples of URLs from MySQLdb
  • Creates a list of URLs
  • Trying to open urls using urllib2 or selenium based on certain factors.
  • When you open using selenium, a new instance is created each time, therefore:
    driver = webdriver.Firefox() driver.get(url) do other things (either open links or get page source) driver.close() 

    As far as I can tell, the error occurs in the second stage (get url).

    I set the script wait condition to something like: config to very high numbers and 0, and I'm still getting an error.

    Is there a solution to this problem?

    Note. I do not open my pages for testing. Rather, I open a third-party site to receive certain data. Also note that sometimes the volume can be quite high (many pages are opened simultaneously by different programs) - maybe a problem?

    My problem now basically is that I can’t even reproduce the problem on another computer, I’m just completely lost. I hope someone else has a similar problem and found a solution. I have a feeling that this is due to the settings in Firefox (not about: config).

+6
source share
2 answers

After several attempts at customization, I think I found one that works, and, alas, it was mentioned here, I just did not understand how to use it (b / c. I never set up a Firefox selenium profile): Selenium and Firefox: How can I turn off the "Unresponsive script" warning?

The solution is as follows:

 from selenium import webdriver fp = webdriver.FirefoxProfile() fp.set_preference("dom.max_chrome_script_run_time", 0) fp.set_preference("dom.max_script_run_time", 0) driver = webdriver.Firefox(firefox_profile=fp) 
+11
source
 public class Send10000CharactersToChat { private static WebDriver firefoxDriver; @Before public void initialize() { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("dom.max_chrome_script_run_time", 0); profile.setPreference("dom.max_script_run_time", 0); firefoxDriver = new FirefoxDriver(profile); } } 
+1
source

Source: https://habr.com/ru/post/954561/


All Articles