K
K
kovalr2019-10-02 16:11:21
Python
kovalr, 2019-10-02 16:11:21

Why doesn't chromium (selenium python) remove .org.chromium.Chromium.16etJh files?

Hello!
There is a script which tests a web page. Runs on Linux, written in Python , selenium , ChromeDriver 2.40.565383
The script runs around the page, extracts data, adds it to the database and then closes the API
driver.quit()
And so every 15 minutes.
Here is an abstract example

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from pyvirtualdisplay import Display
from sys import exit
import time
import re
import pymysql.cursors
import sys

while True:
    #this is body code
    # Start virtual display
    display = Display(visible=0, size=(1024, 768))
    display.start()

    # Initialization selenium driver

    chrome_options = Options()
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--disable-setuid-sandbox")
    chrome_options.add_argument("user-data-dir=/tmp/ChromeSelenium/loda/");
    driver = webdriver.Chrome('./drivers/chromedriver', chrome_options=chrome_options)

    driver.get("URL")
    SOME_CODE_HERE 

    # Quit Selenium driver
    driver.quit()

    # Stop virtual display
    display.stop()

    # Sleep before starting new loop
    print ('Set pausa time')
    for i in range(900, 0, -1):
        sys.stdout.write(str(i) + ' ')
        sys.stdout.flush()
        time.sleep(1)

There are three such scripts.
The problem is that after a few days there are many folders in /tmp/
/.org.chromium.Chromium.16etJh
/.org.chromium.Chromium.izddfJh
/.org.chromium.Chromium.przJwN
/.org.chromium.Chromium.qmbBd

Googled, tried to add an option
chrome_options.add_argument("user-data-dir=/tmp/ChromeSelenium/moda/");

but it did not help, the files are still being created in
/tmp/.*
Help me figure out what I'm doing wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2019-10-02
@kovalr

This is most likely a bug
I fixed it by adding it to crontab
With Firefox, as far as I remember, the same problem
PS

# Sleep before starting new loop
    print ('Set pausa time')
    for i in range(900, 0, -1):
        sys.stdout.write(str(i) + ' ')
        sys.stdout.flush()
        time.sleep(1)

Remove this thing, add the script itself to Cron
https://www.adminschoice.com/crontab-quick-reference

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question