teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

さらにコードを修正

2018/02/09 04:34

投稿

moscow3
moscow3

スコア201

title CHANGED
File without changes
body CHANGED
@@ -66,7 +66,7 @@
66
66
  from selenium import webdriver
67
67
  from selenium.webdriver.common.keys import Keys
68
68
 
69
- driver = webdriver.Chrome("C:/Users/user/AppData/Local/Program/Python/Python36-32/MyScript/chromedriver_win32")
69
+ driver = webdriver.Chrome("C:/Users/user/AppData/Local/Program/Python/Python36-32/MyScript/chromedriver_win32/chromedriver.exe")
70
70
  content = driver.find_element_by_name("q")
71
71
  content.send_keys("this is test")
72
72
  content.send_keys(Keys.ENTER)
@@ -89,11 +89,11 @@
89
89
 
90
90
  Traceback (most recent call last):
91
91
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\MyScript\SeleniumTest.py", line 6, in <module>
92
- driver = webdriver.Chrome("C:/Users/user/AppData/Local/Program/Python/Python36-32/MyScript/chromedriver_win32")
92
+ driver = webdriver.Chrome("C:/Users/user/AppData/Local/Program/Python/Python36-32/MyScript/chromedriver_win32/chromedriver.exe")
93
93
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
94
94
  self.service.start()
95
95
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
96
96
  os.path.basename(self.path), self.start_error_message)
97
- selenium.common.exceptions.WebDriverException: Message: 'chromedriver_win32' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
97
+ selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
98
98
 
99
99
  ```

2

回答を受けて追記

2018/02/09 04:34

投稿

moscow3
moscow3

スコア201

title CHANGED
File without changes
body CHANGED
@@ -56,4 +56,44 @@
56
56
  driver.quit()
57
57
  ```
58
58
 
59
- 32bit版しかなかったので、それを使ったことが原因かなと思うのですが、64bit版はどこにあるのでしょうか?
59
+ 32bit版しかなかったので、それを使ったことが原因かなと思うのですが、64bit版はどこにあるのでしょうか?
60
+
61
+
62
+ #追記
63
+ ```python
64
+ # -*- coding: utf-8 -*-
65
+
66
+ from selenium import webdriver
67
+ from selenium.webdriver.common.keys import Keys
68
+
69
+ driver = webdriver.Chrome("C:/Users/user/AppData/Local/Program/Python/Python36-32/MyScript/chromedriver_win32")
70
+ content = driver.find_element_by_name("q")
71
+ content.send_keys("this is test")
72
+ content.send_keys(Keys.ENTER)
73
+
74
+ ```
75
+
76
+
77
+ エラーメッセージ
78
+ ```ここに言語を入力
79
+ Traceback (most recent call last):
80
+ File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
81
+ stdout=self.log_file, stderr=self.log_file)
82
+ File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
83
+ restore_signals, start_new_session)
84
+ File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
85
+ startupinfo)
86
+ FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。
87
+
88
+ During handling of the above exception, another exception occurred:
89
+
90
+ Traceback (most recent call last):
91
+ File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\MyScript\SeleniumTest.py", line 6, in <module>
92
+ driver = webdriver.Chrome("C:/Users/user/AppData/Local/Program/Python/Python36-32/MyScript/chromedriver_win32")
93
+ File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
94
+ self.service.start()
95
+ File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
96
+ os.path.basename(self.path), self.start_error_message)
97
+ selenium.common.exceptions.WebDriverException: Message: 'chromedriver_win32' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
98
+
99
+ ```

1

表現の訂正

2018/02/09 04:31

投稿

moscow3
moscow3

スコア201

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,5 @@
1
1
  #問題
2
- http://chromedriver.storage.googleapis.com/index.html?path=2.9/より、ドライバーをインストールして実行したのですが、くいきませんん
2
+ http://chromedriver.storage.googleapis.com/index.html?path=2.9/より、ドライバーをインストールして実行したのですが、実行すると途中で強制停止しす。
3
- #実行環境
4
3
  Windows10 64bit
5
4
  python3.6.3
6
5