回答編集履歴
7
追記
test
CHANGED
@@ -357,3 +357,39 @@
|
|
357
357
|
1, ログメッセージに`chrome failed to start`のメッセージは出力されているのでしょうか?
|
358
358
|
|
359
359
|
2, Proxyの設定をされていますか?こちらは特にProxyは使っていません。
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
---
|
364
|
+
|
365
|
+
オプションの纏めありがとうございました。
|
366
|
+
|
367
|
+
あと考えられる点としては、最小構成でChromeを起動してみるぐらいかと。
|
368
|
+
|
369
|
+
|オプション|内容|
|
370
|
+
|
371
|
+
|:--|:--:|
|
372
|
+
|
373
|
+
|--incognito|シークレットモードでChromeを起動|
|
374
|
+
|
375
|
+
|--disable-extensions|拡張機能を無効化|
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
```Python
|
380
|
+
|
381
|
+
options.add_argument('--no-sandbox')
|
382
|
+
|
383
|
+
options.add_argument('--disable-gpu')
|
384
|
+
|
385
|
+
#options.add_argument('--headless')
|
386
|
+
|
387
|
+
options.add_argument('--incognito')
|
388
|
+
|
389
|
+
options.add_argument('--disable-extensions')
|
390
|
+
|
391
|
+
```
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
これで無理でしたら、質問文を現在のコードに改訂して他の人の回答を待ったほうが良いかもしれません。
|
6
追記
test
CHANGED
@@ -335,3 +335,25 @@
|
|
335
335
|
main()
|
336
336
|
|
337
337
|
```
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
---
|
342
|
+
|
343
|
+
うーむ。同じログですかー。そうなると起動オプションの違いでしょうか。
|
344
|
+
|
345
|
+
こちらの起動オプションは
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
```txt
|
350
|
+
|
351
|
+
[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:,
|
352
|
+
|
353
|
+
```
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
1, ログメッセージに`chrome failed to start`のメッセージは出力されているのでしょうか?
|
358
|
+
|
359
|
+
2, Proxyの設定をされていますか?こちらは特にProxyは使っていません。
|
5
chromedriverのログを追記
test
CHANGED
@@ -99,3 +99,239 @@
|
|
99
99
|
上記出力されたデバックログの`Launching chrome:`以前の行にメッセージなどは出てませんでしょうか?
|
100
100
|
|
101
101
|
あと--headless オプションなしでも同じエラーになるのでしょうか?
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
---
|
106
|
+
|
107
|
+
こちらの環境の`Launching chrome:`行以前の`chromedriver.log`です。
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```Json
|
112
|
+
|
113
|
+
[1520116785.758][INFO]: COMMAND InitSession {
|
114
|
+
|
115
|
+
"capabilities": {
|
116
|
+
|
117
|
+
"alwaysMatch": {
|
118
|
+
|
119
|
+
"browserName": "chrome",
|
120
|
+
|
121
|
+
"goog:chromeOptions": {
|
122
|
+
|
123
|
+
"args": [ "--no-sandbox", "--disable-gpu", "--headless" ],
|
124
|
+
|
125
|
+
"extensions": [ ]
|
126
|
+
|
127
|
+
},
|
128
|
+
|
129
|
+
"platformName": "any"
|
130
|
+
|
131
|
+
},
|
132
|
+
|
133
|
+
"firstMatch": [ {
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
} ]
|
138
|
+
|
139
|
+
},
|
140
|
+
|
141
|
+
"desiredCapabilities": {
|
142
|
+
|
143
|
+
"browserName": "chrome",
|
144
|
+
|
145
|
+
"goog:chromeOptions": {
|
146
|
+
|
147
|
+
"args": [ "--no-sandbox", "--disable-gpu", "--headless" ],
|
148
|
+
|
149
|
+
"extensions": [ ]
|
150
|
+
|
151
|
+
},
|
152
|
+
|
153
|
+
"platform": "ANY",
|
154
|
+
|
155
|
+
"version": ""
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
[1520116785.761][INFO]: Populating Preferences file: {
|
162
|
+
|
163
|
+
"alternate_error_pages": {
|
164
|
+
|
165
|
+
"enabled": false
|
166
|
+
|
167
|
+
},
|
168
|
+
|
169
|
+
"autofill": {
|
170
|
+
|
171
|
+
"enabled": false
|
172
|
+
|
173
|
+
},
|
174
|
+
|
175
|
+
"browser": {
|
176
|
+
|
177
|
+
"check_default_browser": false
|
178
|
+
|
179
|
+
},
|
180
|
+
|
181
|
+
"distribution": {
|
182
|
+
|
183
|
+
"import_bookmarks": false,
|
184
|
+
|
185
|
+
"import_history": false,
|
186
|
+
|
187
|
+
"import_search_engine": false,
|
188
|
+
|
189
|
+
"make_chrome_default_for_user": false,
|
190
|
+
|
191
|
+
"skip_first_run_ui": true
|
192
|
+
|
193
|
+
},
|
194
|
+
|
195
|
+
"dns_prefetching": {
|
196
|
+
|
197
|
+
"enabled": false
|
198
|
+
|
199
|
+
},
|
200
|
+
|
201
|
+
"profile": {
|
202
|
+
|
203
|
+
"content_settings": {
|
204
|
+
|
205
|
+
"pattern_pairs": {
|
206
|
+
|
207
|
+
"https://*,*": {
|
208
|
+
|
209
|
+
"media-stream": {
|
210
|
+
|
211
|
+
"audio": "Default",
|
212
|
+
|
213
|
+
"video": "Default"
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
},
|
222
|
+
|
223
|
+
"default_content_setting_values": {
|
224
|
+
|
225
|
+
"geolocation": 1
|
226
|
+
|
227
|
+
},
|
228
|
+
|
229
|
+
"default_content_settings": {
|
230
|
+
|
231
|
+
"geolocation": 1,
|
232
|
+
|
233
|
+
"mouselock": 1,
|
234
|
+
|
235
|
+
"notifications": 1,
|
236
|
+
|
237
|
+
"popups": 1,
|
238
|
+
|
239
|
+
"ppapi-broker": 1
|
240
|
+
|
241
|
+
},
|
242
|
+
|
243
|
+
"password_manager_enabled": false
|
244
|
+
|
245
|
+
},
|
246
|
+
|
247
|
+
"safebrowsing": {
|
248
|
+
|
249
|
+
"enabled": false
|
250
|
+
|
251
|
+
},
|
252
|
+
|
253
|
+
"search": {
|
254
|
+
|
255
|
+
"suggest_enabled": false
|
256
|
+
|
257
|
+
},
|
258
|
+
|
259
|
+
"translate": {
|
260
|
+
|
261
|
+
"enabled": false
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
[1520116785.764][INFO]: Populating Local State file: {
|
268
|
+
|
269
|
+
"background_mode": {
|
270
|
+
|
271
|
+
"enabled": false
|
272
|
+
|
273
|
+
},
|
274
|
+
|
275
|
+
"ssl": {
|
276
|
+
|
277
|
+
"rev_checking": {
|
278
|
+
|
279
|
+
"enabled": false
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
```
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
```Python
|
292
|
+
|
293
|
+
# -*- coding: utf-8 -*-
|
294
|
+
|
295
|
+
from selenium import webdriver
|
296
|
+
|
297
|
+
from selenium.webdriver.chrome.options import Options
|
298
|
+
|
299
|
+
import sys
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
def main():
|
306
|
+
|
307
|
+
print(sys.version)
|
308
|
+
|
309
|
+
options = Options()
|
310
|
+
|
311
|
+
options.add_argument('--no-sandbox')
|
312
|
+
|
313
|
+
options.add_argument('--disable-gpu')
|
314
|
+
|
315
|
+
options.add_argument('--headless')
|
316
|
+
|
317
|
+
log_path = r"C:\selenium\chromedriver.log"
|
318
|
+
|
319
|
+
executable_path = 'C:\selenium\chromedriver.exe'
|
320
|
+
|
321
|
+
driver = webdriver.Chrome(chrome_options=options, executable_path=executable_path, service_args=["--verbose", f"--log-path={log_path}"])
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
driver.get('https://www.google.co.jp')
|
326
|
+
|
327
|
+
driver.save_screenshot('screen.png')
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
if __name__ == "__main__":
|
334
|
+
|
335
|
+
main()
|
336
|
+
|
337
|
+
```
|
4
追記
test
CHANGED
@@ -93,3 +93,9 @@
|
|
93
93
|
driver = webdriver.Chrome(r'C:\selenium\chromedriver', service_args=["--verbose", f"--log-path={log_path}"])
|
94
94
|
|
95
95
|
```
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
上記出力されたデバックログの`Launching chrome:`以前の行にメッセージなどは出てませんでしょうか?
|
100
|
+
|
101
|
+
あと--headless オプションなしでも同じエラーになるのでしょうか?
|
3
追記
test
CHANGED
@@ -79,3 +79,17 @@
|
|
79
79
|
```
|
80
80
|
|
81
81
|
[Chrome Driver 2.35のダウンロード先](https://chromedriver.storage.googleapis.com/index.html?path=2.35/)
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
---
|
86
|
+
|
87
|
+
[Chrome Driverのデバックログの出力方法](https://sites.google.com/a/chromium.org/chromedriver/logging)
|
88
|
+
|
89
|
+
```Python
|
90
|
+
|
91
|
+
log_path = r"C:\selenium\qc1.log"
|
92
|
+
|
93
|
+
driver = webdriver.Chrome(r'C:\selenium\chromedriver', service_args=["--verbose", f"--log-path={log_path}"])
|
94
|
+
|
95
|
+
```
|
2
追記
test
CHANGED
@@ -77,3 +77,5 @@
|
|
77
77
|
|
78
78
|
|
79
79
|
```
|
80
|
+
|
81
|
+
[Chrome Driver 2.35のダウンロード先](https://chromedriver.storage.googleapis.com/index.html?path=2.35/)
|
1
実行環境を追加
test
CHANGED
@@ -51,3 +51,29 @@
|
|
51
51
|
|
52
52
|
|
53
53
|
```
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
こちらの実行環境も書いておきます。
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
Chrome バージョン: 64.0.3282.186(Official Build) (64 ビット)
|
62
|
+
|
63
|
+
Chrome Driver 2.35
|
64
|
+
|
65
|
+
python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
■フォルダ構成
|
70
|
+
|
71
|
+
```txt
|
72
|
+
|
73
|
+
C:\selenium\
|
74
|
+
|
75
|
+
|- chromedriver.exe
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
```
|