回答編集履歴
7
追記
answer
CHANGED
@@ -177,4 +177,22 @@
|
|
177
177
|
```
|
178
178
|
|
179
179
|
1, ログメッセージに`chrome failed to start`のメッセージは出力されているのでしょうか?
|
180
|
-
2, Proxyの設定をされていますか?こちらは特にProxyは使っていません。
|
180
|
+
2, Proxyの設定をされていますか?こちらは特にProxyは使っていません。
|
181
|
+
|
182
|
+
---
|
183
|
+
オプションの纏めありがとうございました。
|
184
|
+
あと考えられる点としては、最小構成でChromeを起動してみるぐらいかと。
|
185
|
+
|オプション|内容|
|
186
|
+
|:--|:--:|
|
187
|
+
|--incognito|シークレットモードでChromeを起動|
|
188
|
+
|--disable-extensions|拡張機能を無効化|
|
189
|
+
|
190
|
+
```Python
|
191
|
+
options.add_argument('--no-sandbox')
|
192
|
+
options.add_argument('--disable-gpu')
|
193
|
+
#options.add_argument('--headless')
|
194
|
+
options.add_argument('--incognito')
|
195
|
+
options.add_argument('--disable-extensions')
|
196
|
+
```
|
197
|
+
|
198
|
+
これで無理でしたら、質問文を現在のコードに改訂して他の人の回答を待ったほうが良いかもしれません。
|
6
追記
answer
CHANGED
@@ -166,4 +166,15 @@
|
|
166
166
|
|
167
167
|
if __name__ == "__main__":
|
168
168
|
main()
|
169
|
-
```
|
169
|
+
```
|
170
|
+
|
171
|
+
---
|
172
|
+
うーむ。同じログですかー。そうなると起動オプションの違いでしょうか。
|
173
|
+
こちらの起動オプションは
|
174
|
+
|
175
|
+
```txt
|
176
|
+
[1520118045.361][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-gpu --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --headless --ignore-certificate-errors --load-extension="C:\Users\ユーザー名\AppData\Local\Temp\scoped_dir112260_27266\internal" --log-level=0 --metrics-recording-only --no-first-run --no-sandbox --password-store=basic --remote-debugging-port=12303 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\ユーザー名\AppData\Local\Temp\scoped_dir112260_30968" data:,
|
177
|
+
```
|
178
|
+
|
179
|
+
1, ログメッセージに`chrome failed to start`のメッセージは出力されているのでしょうか?
|
180
|
+
2, Proxyの設定をされていますか?こちらは特にProxyは使っていません。
|
5
chromedriverのログを追記
answer
CHANGED
@@ -48,4 +48,122 @@
|
|
48
48
|
```
|
49
49
|
|
50
50
|
上記出力されたデバックログの`Launching chrome:`以前の行にメッセージなどは出てませんでしょうか?
|
51
|
-
あと--headless オプションなしでも同じエラーになるのでしょうか?
|
51
|
+
あと--headless オプションなしでも同じエラーになるのでしょうか?
|
52
|
+
|
53
|
+
---
|
54
|
+
こちらの環境の`Launching chrome:`行以前の`chromedriver.log`です。
|
55
|
+
|
56
|
+
```Json
|
57
|
+
[1520116785.758][INFO]: COMMAND InitSession {
|
58
|
+
"capabilities": {
|
59
|
+
"alwaysMatch": {
|
60
|
+
"browserName": "chrome",
|
61
|
+
"goog:chromeOptions": {
|
62
|
+
"args": [ "--no-sandbox", "--disable-gpu", "--headless" ],
|
63
|
+
"extensions": [ ]
|
64
|
+
},
|
65
|
+
"platformName": "any"
|
66
|
+
},
|
67
|
+
"firstMatch": [ {
|
68
|
+
|
69
|
+
} ]
|
70
|
+
},
|
71
|
+
"desiredCapabilities": {
|
72
|
+
"browserName": "chrome",
|
73
|
+
"goog:chromeOptions": {
|
74
|
+
"args": [ "--no-sandbox", "--disable-gpu", "--headless" ],
|
75
|
+
"extensions": [ ]
|
76
|
+
},
|
77
|
+
"platform": "ANY",
|
78
|
+
"version": ""
|
79
|
+
}
|
80
|
+
}
|
81
|
+
[1520116785.761][INFO]: Populating Preferences file: {
|
82
|
+
"alternate_error_pages": {
|
83
|
+
"enabled": false
|
84
|
+
},
|
85
|
+
"autofill": {
|
86
|
+
"enabled": false
|
87
|
+
},
|
88
|
+
"browser": {
|
89
|
+
"check_default_browser": false
|
90
|
+
},
|
91
|
+
"distribution": {
|
92
|
+
"import_bookmarks": false,
|
93
|
+
"import_history": false,
|
94
|
+
"import_search_engine": false,
|
95
|
+
"make_chrome_default_for_user": false,
|
96
|
+
"skip_first_run_ui": true
|
97
|
+
},
|
98
|
+
"dns_prefetching": {
|
99
|
+
"enabled": false
|
100
|
+
},
|
101
|
+
"profile": {
|
102
|
+
"content_settings": {
|
103
|
+
"pattern_pairs": {
|
104
|
+
"https://*,*": {
|
105
|
+
"media-stream": {
|
106
|
+
"audio": "Default",
|
107
|
+
"video": "Default"
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
"default_content_setting_values": {
|
113
|
+
"geolocation": 1
|
114
|
+
},
|
115
|
+
"default_content_settings": {
|
116
|
+
"geolocation": 1,
|
117
|
+
"mouselock": 1,
|
118
|
+
"notifications": 1,
|
119
|
+
"popups": 1,
|
120
|
+
"ppapi-broker": 1
|
121
|
+
},
|
122
|
+
"password_manager_enabled": false
|
123
|
+
},
|
124
|
+
"safebrowsing": {
|
125
|
+
"enabled": false
|
126
|
+
},
|
127
|
+
"search": {
|
128
|
+
"suggest_enabled": false
|
129
|
+
},
|
130
|
+
"translate": {
|
131
|
+
"enabled": false
|
132
|
+
}
|
133
|
+
}
|
134
|
+
[1520116785.764][INFO]: Populating Local State file: {
|
135
|
+
"background_mode": {
|
136
|
+
"enabled": false
|
137
|
+
},
|
138
|
+
"ssl": {
|
139
|
+
"rev_checking": {
|
140
|
+
"enabled": false
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
```
|
145
|
+
|
146
|
+
```Python
|
147
|
+
# -*- coding: utf-8 -*-
|
148
|
+
from selenium import webdriver
|
149
|
+
from selenium.webdriver.chrome.options import Options
|
150
|
+
import sys
|
151
|
+
|
152
|
+
|
153
|
+
def main():
|
154
|
+
print(sys.version)
|
155
|
+
options = Options()
|
156
|
+
options.add_argument('--no-sandbox')
|
157
|
+
options.add_argument('--disable-gpu')
|
158
|
+
options.add_argument('--headless')
|
159
|
+
log_path = r"C:\selenium\chromedriver.log"
|
160
|
+
executable_path = 'C:\selenium\chromedriver.exe'
|
161
|
+
driver = webdriver.Chrome(chrome_options=options, executable_path=executable_path, service_args=["--verbose", f"--log-path={log_path}"])
|
162
|
+
|
163
|
+
driver.get('https://www.google.co.jp')
|
164
|
+
driver.save_screenshot('screen.png')
|
165
|
+
|
166
|
+
|
167
|
+
if __name__ == "__main__":
|
168
|
+
main()
|
169
|
+
```
|
4
追記
answer
CHANGED
@@ -45,4 +45,7 @@
|
|
45
45
|
```Python
|
46
46
|
log_path = r"C:\selenium\qc1.log"
|
47
47
|
driver = webdriver.Chrome(r'C:\selenium\chromedriver', service_args=["--verbose", f"--log-path={log_path}"])
|
48
|
-
```
|
48
|
+
```
|
49
|
+
|
50
|
+
上記出力されたデバックログの`Launching chrome:`以前の行にメッセージなどは出てませんでしょうか?
|
51
|
+
あと--headless オプションなしでも同じエラーになるのでしょうか?
|
3
追記
answer
CHANGED
@@ -38,4 +38,11 @@
|
|
38
38
|
|- chromedriver.exe
|
39
39
|
|
40
40
|
```
|
41
|
-
[Chrome Driver 2.35のダウンロード先](https://chromedriver.storage.googleapis.com/index.html?path=2.35/)
|
41
|
+
[Chrome Driver 2.35のダウンロード先](https://chromedriver.storage.googleapis.com/index.html?path=2.35/)
|
42
|
+
|
43
|
+
---
|
44
|
+
[Chrome Driverのデバックログの出力方法](https://sites.google.com/a/chromium.org/chromedriver/logging)
|
45
|
+
```Python
|
46
|
+
log_path = r"C:\selenium\qc1.log"
|
47
|
+
driver = webdriver.Chrome(r'C:\selenium\chromedriver', service_args=["--verbose", f"--log-path={log_path}"])
|
48
|
+
```
|
2
追記
answer
CHANGED
@@ -37,4 +37,5 @@
|
|
37
37
|
C:\selenium\
|
38
38
|
|- chromedriver.exe
|
39
39
|
|
40
|
-
```
|
40
|
+
```
|
41
|
+
[Chrome Driver 2.35のダウンロード先](https://chromedriver.storage.googleapis.com/index.html?path=2.35/)
|
1
実行環境を追加
answer
CHANGED
@@ -24,4 +24,17 @@
|
|
24
24
|
main()
|
25
25
|
|
26
26
|
|
27
|
+
```
|
28
|
+
|
29
|
+
こちらの実行環境も書いておきます。
|
30
|
+
|
31
|
+
Chrome バージョン: 64.0.3282.186(Official Build) (64 ビット)
|
32
|
+
Chrome Driver 2.35
|
33
|
+
python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
|
34
|
+
|
35
|
+
■フォルダ構成
|
36
|
+
```txt
|
37
|
+
C:\selenium\
|
38
|
+
|- chromedriver.exe
|
39
|
+
|
27
40
|
```
|