Log de esconderijo de selênio em python
#You will have to edit Selenium Source code to achieve this. I am a noob too, and I dont fully understand the overall consequences of editing source code but here is what I did to achieve hiding the webdriver console window on Windows 7, Python 2.7.
#Locate and edit this file as follows: located at Lib\site-packages\selenium\webdriver\common\service.py in your Python folder.
#Edit the Start() function by adding the creation flags this way: creationflags=CREATE_NO_WINDOW
#The edited method will be as below:
###########################
def start(self):
"""
Starts the Service.
:Exceptions:
- WebDriverException : Raised either when it can't start the service
or when it can't connect to the service
"""
try:
cmd = [self.path]
cmd.extend(self.command_line_args())
self.process = subprocess.Popen(cmd, env=self.env,
close_fds=platform.system() != 'Windows',
stdout=self.log_file, stderr=self.log_file, creationflags=CREATE_NO_WINDOW)
except TypeError:
raise
#########################
# You will have to add the relevant imports:
from win32process import CREATE_NO_WINDOW
#This should also work for Chrome webdriver as they import the same file to start the webdriver process.
Djebbes Rabah