Compare commits

..

3 Commits

Author SHA1 Message Date
Devin AI
60a2b9842d docs: add required packages to SeleniumScrapingTool documentation
- Add selenium and webdriver-manager to installation instructions
- Add prerequisites and system requirements
- Add troubleshooting guidelines
- Add basic usage example with error handling
- Fixes #2153

Co-Authored-By: Joe Moura <joao@crewai.com>
2025-02-17 14:08:10 +00:00
Devin AI
b1860cbb12 docs: add required packages to SeleniumScrapingTool documentation
- Add selenium and webdriver-manager to installation instructions
- Fixes #2153

Co-Authored-By: Joe Moura <joao@crewai.com>
2025-02-17 14:03:55 +00:00
luctrate
1b488b6da7 fix: Missing required template variable 'current_year' in description (#2085) 2025-02-13 10:19:52 -03:00
2 changed files with 42 additions and 2 deletions

View File

@@ -17,12 +17,51 @@ The SeleniumScrapingTool is crafted for high-efficiency web scraping tasks.
It allows for precise extraction of content from web pages by using CSS selectors to target specific elements.
Its design caters to a wide range of scraping needs, offering flexibility to work with any provided website URL.
## Prerequisites
- Python 3.7 or higher
- Chrome browser installed (for ChromeDriver)
## Installation
To get started with the SeleniumScrapingTool, install the crewai_tools package using pip:
### Option 1: All-in-one installation
```shell
pip install 'crewai[tools]' selenium>=4.0.0 webdriver-manager>=3.8.0
```
### Option 2: Step-by-step installation
```shell
pip install 'crewai[tools]'
pip install selenium>=4.0.0
pip install webdriver-manager>=3.8.0
```
### Common Installation Issues
1. If you encounter WebDriver issues, ensure your Chrome browser is up-to-date
2. For Linux users, you might need to install additional system packages:
```shell
sudo apt-get install chromium-chromedriver
```
## Basic Usage
Here's a simple example to get you started with error handling:
```python
from crewai_tools import SeleniumScrapingTool
try:
# Initialize the tool with a specific website
tool = SeleniumScrapingTool(website_url='https://example.com')
# Extract content
content = tool.run()
print(content)
except Exception as e:
print(f"Error during scraping: {str(e)}")
# Ensure proper cleanup in case of errors
tool.cleanup()
```
## Usage Examples

View File

@@ -56,7 +56,8 @@ def test():
Test the crew execution and returns the results.
"""
inputs = {
"topic": "AI LLMs"
"topic": "AI LLMs",
"current_year": str(datetime.now().year)
}
try:
{{crew_name}}().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs)