pythonスクレイピング seleniumのエラーについて
python初心者です
seleniumを使いTOKENLINKというサイトのマーケットにあるアイテムの名前と価格を取得しリストアップしようとしてました。
ですが、実行してみるとエラーが起きてしまいます。
エラーの理由と解決方法を教えてください。
(ソースコードmain.py)
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--headless")
browser = webdriver.Chrome(ChromeDriverManager().install())
url = "https://www.tokenlink.io/market.html"
browser.get(url)
items = browser.find_element('item-name')
print(items[0].text)
(エラーコード)
====== WebDriver manager ======
Current google-chrome version is 96.0.4664
Get LATEST chromedriver version for 96.0.4664 google-chrome
Driver [C:\Users\ume.wdm\drivers\chromedriver\win32\96.0.4664.45\chromedriver.exe] found in cache
C:\Users\ume\PycharmProjects\pythonProject5\main.py:7: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
browser = webdriver.Chrome(ChromeDriverManager().install())
Traceback (most recent call last):
File "C:\Users\ume\PycharmProjects\pythonProject5\main.py", line 12, in
items = browser.find_element('item-name')
File "C:\Users\ume\PycharmProjects\pythonProject5\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1244, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\ume\PycharmProjects\pythonProject5\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
self.error_handler.check_response(response)
File "C:\Users\ume\PycharmProjects\pythonProject5\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid locator
(Session info: chrome=96.0.4664.110)
Stacktrace:
Backtrace:
Ordinal0 [0x00976903+2517251]
Ordinal0 [0x0090F8E1+2095329]
Ordinal0 [0x00812848+1058888]
Ordinal0 [0x0083D5C4+1234372]
Ordinal0 [0x0083D63B+1234491]
Ordinal0 [0x00867812+1406994]
Ordinal0 [0x0085650A+1336586]
Ordinal0 [0x00865BBF+1399743]
Ordinal0 [0x0085639B+1336219]
Ordinal0 [0x008327A7+1189799]
Ordinal0 [0x00833609+1193481]
GetHandleVerifier [0x00B05904+1577972]
GetHandleVerifier [0x00BB0B97+2279047]
GetHandleVerifier [0x00A06D09+534521]
GetHandleVerifier [0x00A05DB9+530601]
Ordinal0 [0x00914FF9+2117625]
Ordinal0 [0x009198A8+2136232]
Ordinal0 [0x009199E2+2136546]
Ordinal0 [0x00923541+2176321]
BaseThreadInitThunk [0x7600FA29+25]
RtlGetAppContainerNamedObjectPath [0x77357A9E+286]
RtlGetAppContainerNamedObjectPath [0x77357A6E+238]
プロセスは終了コード 1 で終了しました