ich einen Python Selenium-Skript, das in einer Schleife ausgeführt wird, beendet sie den Browser alle 100 Iterationen so ...Python Selenium Firefox Skript Absturz nach dem Neustart Treiberinstanz
def init_driver():
ffprofile = webdriver.FirefoxProfile("my_profile");
ffprofile.add_extension(extension="myaddon.xpi")
return driver
driver = init_driver()
for i, item, in enumerate(item_list):
check_item(item)
print ("")
if i == 0:
print ("Ignoring First Item")
elif i % 100 == 0:
driver.quit()
driver = init_driver()
Während des Neustarts des Fahrers stürzt zufällig mit einem Fehler ...
Traceback (most recent call last):
File "C:\scripts\main.py", line 118, in <module>
driver = init_driver()
File "C:\scripts\main.py", line 98, in init_driver
driver = webdriver.Firefox(firefox_profile=ffprofile)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 78, in __init__
self.binary, timeout)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 49, in __init__
self.profile.add_extension()
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 91, in add_extension
self._install_extension(extension)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 287, in _install_extension
shutil.rmtree(tmpdir)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 488, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 378, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 378, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 378, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 383, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\john\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 381, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\john\\AppData\\Local\\Temp\\tmpoaizz71l.webdriver.xpi\\platform\\WINNT_x86-msvc\\components\\imehandler.dll'
Manchmal kann es tausende von Iterationen durchlaufen, ohne zu abzustürzen und zu anderen Zeiten es nach 100
Jedem geschieht irgendwelche Ideen was passiert?
_ "Manchmal passiert einfach Scheiße" _ +1 Ja, das tut es. – aneroid