Donew Experimental Release 0.1.8 🎉
Getting Started

Getting Started with donew

Installation

  1. Install the package using pip:
pip install donew
  1. Install required browsers:
donew-install-browsers

Basic Usage

Here’s a simple example to get started with donew:

import asyncio
from donew import DO
 
async def main():
 
    # Start web navigation
    #pass playwright options to the browser
    browser = await DO.Browse(headless=True, channel="chrome") 
    
    try:
        # Analyze page content
        content = await browser.text()
        print("Page content:", content)
        
        # Get all interactive elements with their context
        elements = browser.elements()
        
        # Smart element detection
        input_fields = {
            elem.element_label or elem.attributes.get("name", ""): id
            for id, elem in elements.items()
            if elem.element_type == "input"
            and elem.attributes.get("type") in ["text", "email"]
        }
        
        # Interact with elements
        for label, element_id in input_fields.items():
            await browser.type(element_id, f"test_{label}")
            
    finally:
        await browser.close()
 
if __name__ == "__main__":
    asyncio.run(main())

Next Steps

Development Setup

If you’re contributing to donew or want to set up a development environment:

  1. Clone the repository:
git clone https://github.com/DONEWio/Do.git
cd Do
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -e ".[dev]"
  1. Install Playwright browsers:
donew-install-browsers

Troubleshooting

Common Issues

  1. Browser Installation Failed

    • Make sure you have sufficient permissions
    • Try running donew-install-browsers with sudo/admin privileges
  2. Connection Errors

    • Check your internet connection
    • Verify the URL is accessible
    • Ensure you’re not being blocked by the target website
  3. Element Not Found

    • Use browser.elements() to list all available elements
    • Check if the element is in an iframe
    • Ensure the element is visible and not dynamically loaded

For more help, visit our GitHub Issues page.