[BUG] ScrapeElementFromWebsiteTool breaks when only website_url or only css_element is set at init
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
The issue names ScrapeElementFromWebsiteTool and SeleniumScrapingTool but no source or test file paths. Start by locating the tool implementation and its tests, then check how initialization selects the argument schema and stores each fixed value. Done means either initialization option can be fixed independently, the remaining argument is requested, and tests cover both cases.
索引モデルが issue の本文から書いたものです。
説明
Description
The docs for ScrapeElementFromWebsiteTool describe website_url and css_element as independently optional at initialization: "If provided during initialization, the agent won't need to specify it when using the tool." That only holds when both are given. Fixing just one of them breaks the tool.
- Only
website_urlfixed: the tool switches to the emptyFixedScrapeElementFromWebsiteToolSchema, so the agent is never asked forcss_elementand every run raisesBoth website_url and css_element must be provided. - Only
css_elementfixed: the value is dropped, because it is only stored insideif website_url is not None:. The agent is still asked for a selector.
Steps to Reproduce
from unittest.mock import MagicMock, patch
from crewai_tools import ScrapeElementFromWebsiteTool
MODULE = "crewai_tools.tools.scrape_element_from_website.scrape_element_from_website"
page = MagicMock(content=b"<html><h1>Title</h1><p class='price'>$10</p></html>")
with patch(f"{MODULE}.safe_get", return_value=page):
a = ScrapeElementFromWebsiteTool(website_url="https://example.com")
print(list(a.args_schema.model_fields)) # []
a.run() # ValueError: Both website_url and css_element must be provided.
b = ScrapeElementFromWebsiteTool(css_element=".price")
print(b.css_element) # None
print(list(b.args_schema.model_fields)) # ['website_url', 'css_element']
Expected behavior
- With only
website_urlfixed, the schema asks the agent forcss_element. - With only
css_elementfixed, the selector is kept and the schema asks the agent forwebsite_url.
SeleniumScrapingTool already stores css_element on its own, outside the website_url check.
Environment
- crewAI and crewAI Tools 1.15.45 (main at
77237ae) - Python 3.13, macOS
Possible Solution
Store css_element independently and pick the args schema from what was fixed at init. I have this ready with tests and will open a PR.
Additional context
I used an AI coding assistant while working on this.
- 主要言語
- Python
- スター
- 61.2k
- フォーク
- 9.2k
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 180
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM provider対応中かも @HashimSyedUBC が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missing対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native Azure provider ignores the seed setting対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
crewAIInc/crewAI#9787 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summary対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
bug harness
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mruangutai/harness#2687 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modal-labs/modal-client#4158 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
The-Swarm-Corporation/swarms-rs#168 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linuxserver/docker-healthchecks#137 · コメント 1 件 ·