[BUG] ScrapeElementFromWebsiteTool breaks when only website_url or only css_element is set at init
I maintainer di solito rispondono entro 1 giorno
@p-tirth ci sta già lavorando.
Dal 27/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 61.2k
- Fork
- 9.2k
- Merge medio
- 1g 14h
- PR unite (30g)
- 180
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crewAIInc/crewAI
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerForse già presa @HashimSyedUBC l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingForse già presa @basil-k-aji-dev l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Native Azure provider ignores the seed settingForse già presa @basil-k-aji-dev l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
crewAIInc/crewAI#9787 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryForse già presa @basil-k-aji-dev l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di crewAIInc/crewAI
Issue simili
-
bug harness
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mruangutai/harness#2687 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modal-labs/modal-client#4158 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
The-Swarm-Corporation/swarms-rs#168 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
linuxserver/docker-healthchecks#137 · 1 commento ·