@mharuka1110 (村上 遥)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

seleniumのエラー

解決したいこと

スクレイピングをする為に環境構築をしています.

from selenium import webdriver

これを実行するとエラーが出てしまいます.

発生している問題・エラー

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12460/2579501256.py in <module>
----> 1 from selenium import webdriver

c:\users\g1823082\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\__init__.py in <module>
     16 # under the License.
     17 
---> 18 from .firefox.webdriver import WebDriver as Firefox  # noqa
     19 from .firefox.firefox_profile import FirefoxProfile  # noqa
     20 from .firefox.options import Options as FirefoxOptions  # noqa

c:\users\g1823082\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\firefox\webdriver.py in <module>
     34 from .options import Options
     35 from .remote_connection import FirefoxRemoteConnection
---> 36 from .service import Service
     37 from .webelement import FirefoxWebElement
     38 

c:\users\g1823082\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\firefox\service.py in <module>
     19 
     20 
---> 21 class Service(service.Service):
     22     """Object that manages the starting and stopping of the
     23     GeckoDriver."""

AttributeError: module 'selenium.webdriver.common.service' has no attribute 'Service'

image.png

よろしくお願いいたします。

0 likes

1Answer

  1. どのようにしてseleniumをインストールしましたか? pip,conda,anaconda, setup.py, ...
  2. pythonのバージョンは (3.8?)?
  3. windowsのバージョンは10でしょうか?
  4. エラーを吐く部分のから上のソースコードはどのようになっていますか?
import selenium
from selenium import webdriver

のようにseleniumを2度インポートしていたりするとこういったエラーがでる事がある事もありますが、エスパーではないのでこれ以上はわかりかねます。
上にあげた4点を追記したらリアクションをください。多分容易に解決しますよ:thumbsup:

0Like

Your answer might help someone💌