前提・実現したいこと
https://a-zumi.net/python-selenium-find-element-by-link-text/
上記のサイトに記載されているプログラムを無事に実行させたい.
発生している問題・エラーメッセージ
Traceback (most recent call last):
File "test1.py", line 11, in <module>
driver.find_element_by_link_text(u"ニュース").click()
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <a id="nsearch" href="https://rdsig.yahoo.co.jp/_ylt=A7dPhhDxvJZani0AEniAcQF8/RV=2/RE=1519914609/RH=cmRzaWcueWFob28uY28uanA-/RB=/RU=aHR0cHM6Ly9uZXdzLnlhaG9vLmNvLmpwLwA-/RK=0/RS=DCKK3Ar12WdVbv0nPTan5nlo9UY-"> could not be scrolled into view
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/init.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/init.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "test1.py", line 11, in <module>
driver.find_element_by_link_text(u"ニュース").click()
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <a id="nsearch" href="https://rdsig.yahoo.co.jp/_ylt=A7dPhhDxvJZani0AEniAcQF8/RV=2/RE=1519914609/RH=cmRzaWcueWFob28uY28uanA-/RB=/RU=aHR0cHM6Ly9uZXdzLnlhaG9vLmNvLmpwLwA-/RK=0/RS=DCKK3Ar12WdVbv0nPTan5nlo9UY-"> could not be scrolled into view
該当のソースコード
python
# coding: utf-8 from selenium import webdriver import time # FireFoxを起動 driver = webdriver.Firefox() # ヤフーへアクセス driver.get("http://www.yahoo.co.jp") # ニュースを探してクリック driver.find_element_by_link_text(u"ニュース").click() # 5秒待つ time.sleep(5) # 終了 driver.close()
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
よろしくお願いいたします
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/01 03:39 編集
2018/03/01 04:05
2018/03/01 04:15