zoukankan      html  css  js  c++  java
  • 自动化测试归纳总结

    隐藏掉chromdriver在控制台的输出
    stackoverflow 的 答案如下:

    
    6
    down vote
    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-packagesseleniumwebdrivercommonservices.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.
    
    如果有来生,一个人去远行,看不同的风景,感受生命的活力。。。
  • 相关阅读:
    C++primer习题3.13
    Indesign技巧
    《转载》虚函数在对象中的内存布局
    C++new失败后如何处理
    sizeof的用法
    转载 C++中虚继承防止二义性
    字符串反转
    回文写法
    C++术语
    QT+VS2008
  • 原文地址:https://www.cnblogs.com/Frank99/p/9888121.html
Copyright © 2011-2022 走看看