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

質問編集履歴

2

②options.addArguments("--no-sandbox")追加時の挙動を追加

2021/10/17 05:15

投稿

RHira
RHira

スコア0

title CHANGED
File without changes
body CHANGED
@@ -109,7 +109,7 @@
109
109
  Win10 Pro 21H1 64bit
110
110
 
111
111
  ###追記
112
- Docker Imageの状態
112
+ Docker Imageの状態
113
113
  ```PowerShell
114
114
  PS C:\Users..> docker images
115
115
  REPOSITORY TAG IMAGE ID CREATED SIZE
@@ -117,4 +117,75 @@
117
117
  docker101tutorial latest c7031e4fa799 3 hours ago 28.3MB
118
118
  alpine/git latest 612b988140be 6 days ago 27.4MB
119
119
  selenium/standalone-chrome 3.141.59-xenon da74f3fdcfe2 24 months ago 852MB
120
+ ```
121
+
122
+ ②options.add_Arguments("--no-sandbox")追加後
123
+ ```jupyter
124
+ os.chdir('I:/suisui')
125
+
126
+ from selenium import webdriver
127
+
128
+ # Chrome のオプションを設定する
129
+ options = webdriver.ChromeOptions()
130
+ options.add_argument('--headless')
131
+ options.add_argument('--no-sandbox')
132
+
133
+ # Selenium Server に接続する
134
+ driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub',desired_capabilities=options.to_capabilities(),options=options,)
135
+
136
+ # Selenium 経由でブラウザを操作する
137
+ driver.get('https://qiita.com')
138
+ print(driver.current_url)
139
+
140
+ # ブラウザを終了する
141
+ driver.quit()
142
+ ```
143
+ ②続き。応答内容
144
+ ```jupyter
145
+ <ipython-input-10-f81577d73398>:11: DeprecationWarning: desired_capabilities has been deprecated, please pass in an Options object with options kwarg
146
+ driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub',desired_capabilities=options.to_capabilities(),options=options,)
147
+ ---------------------------------------------------------------------------
148
+ WebDriverException Traceback (most recent call last)
149
+ <ipython-input-10-f81577d73398> in <module>
150
+ 9
151
+ 10 # Selenium Server に接続する
152
+ ---> 11 driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub',desired_capabilities=options.to_capabilities(),options=options,)
153
+ 12
154
+ 13 # Selenium 経由でブラウザを操作する
155
+
156
+ ~\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
157
+ 264 self.file_detector = file_detector or LocalFileDetector()
158
+ 265 self.start_client()
159
+ --> 266 self.start_session(capabilities, browser_profile)
160
+ 267
161
+ 268 def __repr__(self):
162
+
163
+ ~\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in start_session(self, capabilities, browser_profile)
164
+ 355 parameters = {"capabilities": w3c_caps,
165
+ 356 "desiredCapabilities": capabilities}
166
+ --> 357 response = self.execute(Command.NEW_SESSION, parameters)
167
+ 358 if 'sessionId' not in response:
168
+ 359 response = response['value']
169
+
170
+ ~\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
171
+ 416 response = self.command_executor.execute(driver_command, params)
172
+ 417 if response:
173
+ --> 418 self.error_handler.check_response(response)
174
+ 419 response['value'] = self._unwrap_value(
175
+ 420 response.get('value', None))
176
+
177
+ ~\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
178
+ 241 alert_text = value['alert'].get('text')
179
+ 242 raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
180
+ --> 243 raise exception_class(message, screen, stacktrace)
181
+ 244
182
+ 245 def _value_or_default(self, obj: Mapping[_KT, _VT], key: _KT, default: _VT) -> _VT:
183
+
184
+ WebDriverException: Message: unknown error: Chrome failed to start: crashed
185
+ (chrome not reachable)
186
+ (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
187
+ Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
188
+ System info: host: 'f97debeefe29', ip: '172.17.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.16.3-microsoft-standard-WSL2', java.version: '1.8.0_222'
189
+ Driver info: driver.version: unknown
190
+ remote stacktrace: #0 0x5602d26eb7e9 <unknown>
120
191
  ```

1

Dockerのイメージを追記しました

2021/10/17 05:15

投稿

RHira
RHira

スコア0

title CHANGED
File without changes
body CHANGED
@@ -106,4 +106,15 @@
106
106
  ### 補足情報
107
107
  素人なので、追加で必要な情報があればご連絡くださいm(_ _)m
108
108
  jupyter notebook 6.3.0 <- Anaconda navigaterより
109
- Win10 Pro 21H1 64bit
109
+ Win10 Pro 21H1 64bit
110
+
111
+ ###追記
112
+ Docker Imageの状態
113
+ ```PowerShell
114
+ PS C:\Users..> docker images
115
+ REPOSITORY TAG IMAGE ID CREATED SIZE
116
+ ID/docker101tutorial latest c7031e4fa799 3 hours ago 28.3MB
117
+ docker101tutorial latest c7031e4fa799 3 hours ago 28.3MB
118
+ alpine/git latest 612b988140be 6 days ago 27.4MB
119
+ selenium/standalone-chrome 3.141.59-xenon da74f3fdcfe2 24 months ago 852MB
120
+ ```