Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python selenium hide log

#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 Libsite-packagesseleniumwebdrivercommonservice.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.
Comment

PREVIOUS NEXT
Code Example
Python :: knn plot the clusters 
Python :: count how many vowels in a string python 
Python :: python code for system of odes 
Python :: wap to draw the shape of hexagonn in python 
Python :: how to limit a long text in djagno 
Python :: How do I start a DataFrame index from 1? 
Python :: how to make basic inventory setup in python 
Python :: removing new line character in python from dataframe 
Python :: download stopwords nltk 
Python :: python primera letra mayuscula 
Python :: matlab find in python 
Python :: how to create virtual environment 
Python :: TypeError: Unicode-objects must be encoded before hashing 
Python :: button position python 
Python :: array comparison in percent 
Python :: firebase-admin python 
Python :: bring tkinter window to front 
Python :: Replace empty string and "records with only spaces" with npnan pandas 
Python :: cv2 waitkey 
Python :: numpy slice array into chunks 
Python :: drop null rows pandas 
Python :: django httpresponseredirect 
Python :: train test split python 
Python :: flip specific bit python 
Python :: python bold text 
Python :: django email settings 
Python :: pandas rename index values 
Python :: how to filter out all NaN values in pandas df 
Python :: extract image from pdf python 
Python :: drop rows in list pandas 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =