Issue with Browserless template

callmefredcomPRO

7 months ago

Hi, maybe you can help me. I have set up in a project the Browserless template but each time I try to run a simple Selenium screenshot capture function,
I get this error even if my variables are properly configured in my web app (in the same project):

browserless.io:server:trace Handling inbound HTTP request on "POST: /webdriver/session" +9m
browserless.io:server:error No matching HTTP route handler for "POST: http://0.0.0.0:8080/webdriver/session?launch=%7B%7D"; +9m

I'm using the internal endpoint: http://browserless.railway.internal:3001/webdriver

0 Replies

callmefredcomPRO

7 months ago

11223395-d9b3-48d8-bdf1-5fec7716e393


7 months ago

browserless v1 or v2?


callmefredcomPRO

7 months ago

v2


callmefredcomPRO

7 months ago

This is the start of the function:

def screenshoturl(url, outputpath='screenshot.png'):
# Set up Chrome options for headless browsing
chromeoptions = Options() chromeoptions.setcapability('browserless:token', os.getenv('BROWSERTOKEN'))
chromeoptions.addargument("--window-size=1920,1080")
chromeoptions.addargument("--disable-background-timer-throttling")
chromeoptions.addargument("--disable-backgrounding-occluded-windows")
chromeoptions.addargument("--disable-breakpad")
chromeoptions.addargument("--disable-component-extensions-with-background-pages")
chromeoptions.addargument("--disable-dev-shm-usage")
chromeoptions.addargument("--disable-extensions")
chromeoptions.addargument("--disable-features=TranslateUI,BlinkGenPropertyTrees")
chromeoptions.addargument("--disable-ipc-flooding-protection")
chromeoptions.addargument("--disable-renderer-backgrounding")
chromeoptions.addargument("--enable-features=NetworkService,NetworkServiceInProcess")
chromeoptions.addargument("--force-color-profile=srgb")
chromeoptions.addargument("--hide-scrollbars")
chromeoptions.addargument("--metrics-recording-only")
chromeoptions.addargument("--mute-audio")
chromeoptions.addargument("--headless")
chromeoptions.addargument("--no-sandbox")

# Initialize the browser
try:
    driver = webdriver.Remote(
        command_executor=os.getenv('BROWSER_WEBDRIVER_ENDPOINT'),
        options=chrome_options
    )
except Exception as e:
    print(f"Error initializing WebDriver: {e}")
    return

callmefredcomPRO

7 months ago

it can't reach the endpoint, even if it's properly referenced and printed out if I check it


callmefredcomPRO

7 months ago

is there a catch with V2?


7 months ago

browserless v2 doesnt support selenium


callmefredcomPRO

7 months ago

Ah ok, because I saw in the variables the ones which I thought were for Selenium

1306712462032371700


callmefredcomPRO

7 months ago

BROWSERWEBDRIVERENDPOINT


7 months ago

ill remove them, sorry for the confusion


callmefredcomPRO

7 months ago

so I should just delete this deployment and deploy V1 then?


7 months ago

yep


7 months ago

i can confirm v1 works

1306712772863721500


callmefredcomPRO

7 months ago

ok, will do and keep you posted when tested


7 months ago