pydoll icon indicating copy to clipboard operation
pydoll copied to clipboard

newbie with problems

Open rastarr opened this issue 9 months ago • 1 comments

so very sorry to ask such basic questions like these. Still hoping for some guidance if possible.

I was very excited to see this project mentioned in Reddit. Tried many Claude/ChatGPT chats and have made some progress in creating a docker container that i can access from an n8n.io workflow. I am a total dummy when it comes to python but have attached my Dockerfile build file and my app.py (as text files) for reference.

In my n8n.io workflow, i am getting this error -

The service was not able to process your request
Can't instantiate abstract class Browser with abstract method _get_default_binary_location
Error details

 From HTTP Request
Error code

500

Full message

500 - "{\"error\":\"Can't instantiate abstract class Browser with abstract method _get_default_binary_location\",\"traceback\":\"Traceback (most recent call last):\\n File \\\"/app/app.py\\\", line 145, in get_page_content\\n pydoll = PyDoll()\\nTypeError: Can't instantiate abstract class Browser with abstract method _get_default_binary_location\\n\"}\n"
Request

{ "body": { "url": "https://canva.com", "wait_time": 5, "selector": "div.main-content" }, "headers": { "content-type": "application/json", "accept": "application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7" }, "method": "POST", "uri": "http://192.168.1.28:6000/content", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "timeout": 300000, "encoding": null, "json": false, "useStream": true }

I'm wanting to eventually scrape some Etsy listing pages that I can then extract data and then improve my own new listings, using AI Agents in n8n.

For some reason that escapes my 0% python skills, I'm failing to initialise PyDoll but I have no idea what to do next.

Hoping for some help and also whether this project will get past Etsy's robot detection since I tried with some beginner Puppeteer and get a captcha block.

Hoping for the best lol Cheers Martin

app.txt

Dockerfile.txt

rastarr avatar Mar 10 '25 11:03 rastarr

Hi! Take a look at the quick start guide:

import asyncio
from pydoll.browser.chrome import Chrome
from pydoll.constants import By

async def main():
    # Start the browser with no additional webdriver configuration!
    async with Chrome() as browser:
        await browser.start()
        page = await browser.get_page()
        
        # Navigate through captcha-protected sites without worry
        await page.go_to('https://example-with-cloudflare.com')
        button = await page.find_element(By.CSS_SELECTOR, 'button')
        await button.click()

asyncio.run(main())

You should instantiate Chrome instead of Browser

thalissonvs avatar Mar 10 '25 12:03 thalissonvs

Hi! Take a look at the quick start guide:

import asyncio from pydoll.browser.chrome import Chrome from pydoll.constants import By

async def main(): # Start the browser with no additional webdriver configuration! async with Chrome() as browser: await browser.start() page = await browser.get_page()

    # Navigate through captcha-protected sites without worry
    await page.go_to('https://example-with-cloudflare.com')
    button = await page.find_element(By.CSS_SELECTOR, 'button')
    await button.click()

asyncio.run(main()) You should instantiate Chrome instead of Browser

Hi!

Thank you for this wonderful project!

How can I set a specific location for chrome? I got:

ValueError: Browser not found: C:\Program Files\Google\Chrome\Application\chrome.exe

blap avatar Mar 10 '25 14:03 blap

Hi! Take a look at the quick start guide: import asyncio from pydoll.browser.chrome import Chrome from pydoll.constants import By async def main():

Start the browser with no additional webdriver configuration!

async with Chrome() as browser: await browser.start() page = await browser.get_page()

    # Navigate through captcha-protected sites without worry
    await page.go_to('https://example-with-cloudflare.com')
    button = await page.find_element(By.CSS_SELECTOR, 'button')
    await button.click()

asyncio.run(main()) You should instantiate Chrome instead of Browser

Hi!

Thank you for this wonderful project!

How can I set a specific location for chrome? I got:

ValueError: Browser not found: C:\Program Files\Google\Chrome\Application\chrome.exe

Just do the following:

import asyncio
from pydoll.browser.chrome import Chrome
from pydoll.browser.options import Options
from pydoll.constants import By

async def main():
    # Start the browser with no additional webdriver configuration!
    options = Options()
    options.binary_location = '/your/path/to/chrome'
    async with Chrome(options=options) as browser:
        await browser.start()
        page = await browser.get_page()
        
        # Navigate through captcha-protected sites without worry
        await page.go_to('https://example-with-cloudflare.com')
        button = await page.find_element(By.CSS_SELECTOR, 'button')
        await button.click()

asyncio.run(main())

I'll improve the documentation later :)

thalissonvs avatar Mar 10 '25 14:03 thalissonvs

@thalissonvs Is there a way to prevent browser from auto closing? I'm using it for automation and opening a browser for each request would probably be flagged, so it's best to keep one browser with many tabs open at all times in my case.

TrickyBarrel avatar Mar 10 '25 15:03 TrickyBarrel

@thalissonvs Is there a way to prevent browser from auto closing? I'm using it for automation and opening a browser for each request would probably be flagged, so it's best to keep one browser with many tabs open at all times in my case.

Can you open a discussion? I'll close this issue now

thalissonvs avatar Mar 10 '25 20:03 thalissonvs