2
browser.minimize_window()

when it is not minimized, it can locate elements and download the file I want. but when I minimize it, it fails. why? How can I minimize it and still run the script successfully?

arak
  • 21
  • 4
  • 2
    Selenium set aside - how would you locate any element in a minimized browser manually? I think your question does not make much sense. – Jonathan Scholbach Jan 07 '22 at 13:05
  • ok. I can rephrase my question. How to minimize the chromedriver in selenium in a way that can locate elements. Is there any way? Or Can I run the chromedriver in a secondary monitor? I would prefer the minimized window option if that is possible – arak Jan 07 '22 at 13:08
  • 3
    Why don't you use headless option instead of physically invoking the browser and then minimizing? Using headless does not open the browser to the front at all. In fact you'll not see the browser window. It just happens in the background and runs the code. – Anand Gautam Jan 07 '22 at 13:35
  • I think what you need is a headless browser to do this job, adding the flag `--headless` on the chromeoptions, if that is the case. – ojonasplima Jan 07 '22 at 13:35
  • I know the headless option. I just wanted to make sure if there is any way to run the chromedriver minimized and execute the code. I wanted this because in this way I can look at the chromedriver when I want and see if my script is working correctly if needed. Headless won't allow that. But from the answers I suppose there is no way to make the chromedriver just minimize and work. – arak Jan 07 '22 at 13:38
  • Does [this](https://stackoverflow.com/questions/50494495/can-i-minimize-chrome-window-while-selenium-is-running) help you? – ojonasplima Jan 07 '22 at 13:46
  • Will try this. Do not know if it will work for me yet. Thanks for all the answer everyone. Really appreciate it. – arak Jan 07 '22 at 14:19

0 Answers0