Home > Enterprise >  How do I find download file location in selenium docker container?
How do I find download file location in selenium docker container?

Time:01-12

I have same python script same docker images on different computers. One of them on my good computer but in virtual machine. The other container is in a bad laptop.

On my virtual machine, it works. It also works on my laptop, I mean without any error. However, I cannot find downloaded files on this laptop. I can find them on my virtual machine. I can share a part of my code. What do you think that I am doing wrong? (By the way, I am downloading videos)

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import ElementNotInteractableException
from selenium.common.exceptions import StaleElementReferenceException

options = Options()
options.add_argument("start-maximized")
prefs={"download.default_directory": "/home/seluser/downloads"}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Remote("http://myIP:4444/wd/hub", options=options)
driver.get(someUrl)
print(driver.title)

CodePudding user response:

Guys I found my solution. It is all about linux root permissions, my folder was created as a root folder. So I deleted it and created it with a user (not root user) so it is a non-root folder now. I can find my files in this location. So it is solved :)

  • Related