実現したいこと
Pythonである証券サイトにログイン後、板情報をスクレイピングしたいです。
証券口座を持っていないと思うので、コードを見ただけで、考えられる改善点がございましたら、ご指摘いただけると嬉しいです。
前提
VSCodeを使っています。
ログインはSeleniumでできました。
しかし、板情報は、Seleniumを使ってもBeautiful Soupを使っても入手できません。
発生している問題・エラーメッセージ
NoSuchElementException Traceback (most recent call last) Cell In[1], line 40 ---> 40 get_price = driver.find_element(By.XPATH, "/html/body/div/div[3]/div[1]/div/table/tbody[2]/tr[10]/td[3]/span") NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div/div[3]/div[1]/div/table/tbody[2]/tr[10]/td[3]/span"} (Session info: chrome=114.0.5735.110) Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
該当のソースコード
#省略以下がエラーの原因と思われます。
Python
1#省略 2 3driver.implicitly_wait(5) 4 5get_price = driver.find_element(By.XPATH, "/html/body/div/div[3]/div[1]/div/table/tbody[2]/tr[10]/td[3]/span") 6price = get_price.text 7 8price
試したこと
Selenium、Beautiful Soupどちらも試しました。
要素の指定の仕方もXpathやclassなど、インターネットで調べたあらゆるものを試しました。
Chatgptに聞いてもうまくいきませんでした。

回答1件
あなたの回答
tips
プレビュー