Hướng dẫn ẩn CMD của Chrome Driver khi build .exe cho Python

 





Bước 1: 

Mở file service.py trong thư mục Đường-dẫn-python\Lib\site-packages\selenium\webdriver\common\service.py


Bước 2:

Tìm dòng self.creationflags=0 sửa lại thành self.creationflags=0x08000000


Đối với các phiên bản selenium cũ hơn, các bạn làm theo hướng dẫn phía dưới


STEP 1

Locate service.py, generally in "X:\YourPythonFold\Lib\site-packages\selenium\webdriver\common\service.py"

STEP 2

Replace these lines (n° 72-76 approximately, below start method def):

 

self.process = subprocess.Popen(cmd, env=self.env,

                                            close_fds=platform.system() != 'Windows',

                                            stdout=self.log_file,

                                            stderr=self.log_file,

                                            stdin=PIPE)

with

 

self.process = subprocess.Popen(cmd, env=self.env,

                                            close_fds=platform.system() != 'Windows',

                                            stdout=self.log_file,

                                            stderr=self.log_file,

                                            stdin=PIPE, creationflags=0x08000000)

Đăng nhận xét

Post a Comment (0)

Mới hơn Cũ hơn