セレンのフォルダ全体をメインのpythonフォルダにコピーしたり、パスを変更したり、絶対パスなどを使用したりして、自分で見つけることができたすべてのソリューションを試してみるうちに、次のエラーが表示されます。 、私は本当にPythonとセレンで始まった初心者の助けを感謝します。python selenium windows chrome webdriverエラー
C:\Users\WorkStation\Desktop\chromedriver.exe
Error : -
C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py File "C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3 driver = webdriver.Chrome("C:\Users\WorkStation\Desktop\chromedriver.exe") ^SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Process finished with exit code 1
その後、私はこれを試してみましたが、今より多くのエラー:
driver = webdriver.Chrome("C:\\Users\\WorkStation\\Desktop\\chromedriver.exe")
Error : -
C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 665, in init errread, errwrite) = self._get_handles(stdin, stdout, stderr) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 910, in _get_handles c2pwrite = msvcrt.get_osfhandle(self._get_devnull()) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 770, in _get_devnull self._devnull = os.open(os.devnull, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3, in driver = webdriver.Chrome("C:\Users\WorkStation\Desktop\chromedriver.exe") File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in init self.service.start() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.
Exception ignored in: > Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 173, in del self.stop() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 145, in stop if self.process is None: AttributeError: 'Service' object has no attribute 'process'
Process finished with exit code 1
でもメインのpythonフォルダへのsite-packagesフォルダからセレンファイルをコピーして、絶対に追加した後パスが機能していない 上記の手順を実行した後、エラーは
ですここC:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 665, in init errread, errwrite) = self._get_handles(stdin, stdout, stderr) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 910, in _get_handles c2pwrite = msvcrt.get_osfhandle(self._get_devnull()) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 770, in _get_devnull self._devnull = os.open(os.devnull, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3, in driver = webdriver.Chrome("C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\chromedriver.exe") File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\webdriver.py", line 62, in init self.service.start() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.
Exception ignored in: > Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 173, in del self.stop() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 145, in stop if self.process is None: AttributeError: 'Service' object has no attribute 'process'
Process finished with exit code 1
問題のスクリーンショットがPyCharm
であるシステム設定:
windows 32-bit
PyDispatcher 2.0.5 2.0.5
attrs 16.3.0 16.3.0
beautifulsoup4 4.5.3 4.5.3
cffi 1.9.1 1.9.1
constantly 15.1.0 15.1.0
cryptography 1.7.1 1.7.1
cssselect 1.0.0 1.0.0
idna 2.2 2.2
incremental 16.10.1 16.10.1
mechanize 0.2.5 0.2.5
pip 9.0.1 9.0.1
pyOpenSSL 16.2.0 16.2.0
pyasn1 0.1.9 0.1.9
pyasn1-modules 0.0.8 0.0.8
pycparser 2.17 2.17
requests 2.12.4 2.12.4
selenium 3.0.2 3.0.2
service-identity 16.0.0
setuptools 32.3.1 32.3.1
six 1.10.0 1.10.0
urllib3 1.19.1 1.19.1
wheel 0.29.0 0.30.0a0
zope.interface 4.3.3 4.3.3
Chrome webdriver Latest Version 2.27
Chrome browser Version Version 55.0.2883.87 m (Up to date)
を:http://stackoverflow.com/a/42478941/5986816 –