質問編集履歴

1

誤字

2020/11/20 10:55

投稿

ume1010
ume1010

スコア4

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,117 @@
1
- homebrewからchromedriverをインストールし、下のようにコードを書いたのですが、chromeを立ち上げるところでエラーが出てしまいました。考えらる原因はなんでしょうか?よろしくお願いします。
1
+ homebrewからchromedriverをインストールし、下のようにコードを書いたのですが、browser = webdriver.Chrome() のところでエラーが出てしまいました。考えらる原因はなんでしょうか?よろしくお願いします。
2
2
 
3
- ](bc2cb527e2ec50f1fe7791fa9a595a17.png)
3
+
4
+
5
+ !pip install selenium
6
+
7
+
8
+
9
+ !pip install beautifulsoup4
10
+
11
+
12
+
13
+ from selenium import webdriver
14
+
15
+
16
+
17
+ import time
18
+
19
+ import pandas as bd
20
+
21
+
22
+
23
+ USER = "test_user"
24
+
25
+ PASS = "test_pw"
26
+
27
+
28
+
29
+ browser = webdriver.Chrome()
30
+
31
+ browser.implicitly_wait(5)**
32
+
33
+ #エラー箇所
34
+
35
+ ---------------------------------------------------------------------------
36
+
37
+ WebDriverException Traceback (most recent call last)
38
+
39
+ <ipython-input-5-a95e7033a7bf> in <module>
40
+
41
+ ----> 1 browser = webdriver.Chrome()
42
+
43
+ 2 browser.implicitly_wait(5)
44
+
45
+
46
+
47
+ ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
48
+
49
+ 74
50
+
51
+ 75 try:
52
+
53
+ ---> 76 RemoteWebDriver.__init__(
54
+
55
+ 77 self,
56
+
57
+ 78 command_executor=ChromeRemoteConnection(
58
+
59
+
60
+
61
+ ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
62
+
63
+ 155 warnings.warn("Please use FirefoxOptions to set browser profile",
64
+
65
+ 156 DeprecationWarning, stacklevel=2)
66
+
67
+ --> 157 self.start_session(capabilities, browser_profile)
68
+
69
+ 158 self._switch_to = SwitchTo(self)
70
+
71
+ 159 self._mobile = Mobile(self)
72
+
73
+
74
+
75
+ ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities, browser_profile)
76
+
77
+ 250 parameters = {"capabilities": w3c_caps,
78
+
79
+ 251 "desiredCapabilities": capabilities}
80
+
81
+ --> 252 response = self.execute(Command.NEW_SESSION, parameters)
82
+
83
+ 253 if 'sessionId' not in response:
84
+
85
+ 254 response = response['value']
86
+
87
+
88
+
89
+ ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
90
+
91
+ 319 response = self.command_executor.execute(driver_command, params)
92
+
93
+ 320 if response:
94
+
95
+ --> 321 self.error_handler.check_response(response)
96
+
97
+ 322 response['value'] = self._unwrap_value(
98
+
99
+ 323 response.get('value', None))
100
+
101
+
102
+
103
+ ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
104
+
105
+ 240 alert_text = value['alert'].get('text')
106
+
107
+ 241 raise exception_class(message, screen, stacktrace, alert_text)
108
+
109
+ --> 242 raise exception_class(message, screen, stacktrace)
110
+
111
+ 243
112
+
113
+ 244 def _value_or_default(self, obj, key, default):
114
+
115
+
116
+
117
+ WebDriverException: Message: unknown error: cannot find Chrome binary