Giter Site home page Giter Site logo

Comments (6)

ecarter202 avatar ecarter202 commented on August 28, 2024

I continually get the following error(s) when trying to visit Newegg.com, wikipedia.org, etc...:

ERROR: Browser failed to start before browser startup time cutoff
panic: Chrome console failed to init in the alotted time

from headlesschrome.

integrii avatar integrii commented on August 28, 2024

Interesting. Try upping the BrowserStartupTime value... By default it is 20 seconds. It could be that you are unable to startup a chrome process fast enough for some reason...

headlessCrhome.BrowserStartupTime = time.Minute * 5

also, make sure you are running with the right OS. By default we assume MacOS. Set the chrome path with headlessChrome.ChromePath = "somePath". By default, the path is /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.

from headlesschrome.

ecarter202 avatar ecarter202 commented on August 28, 2024

I've made your recommended changes, and it is still not getting any content with https://newegg.com.
`package main

import (
"fmt"
"time"

"github.com/integrii/headlessChrome"

)

func main() {
headlessChrome.BrowserStartupTime = time.Minute * 5

// make a new session
browser, err := headlessChrome.NewBrowser(`http://newegg.com`)
if err != nil {
	panic(err)
}
// Close the browser process when this func returns
defer browser.Exit()

// sleep while content is rendered.  You could replace this
// with some javascript that only returns when the
// content exists to be safer.
time.Sleep(time.Second * 5)

// Query all the HTML from the web site
browser.Write(`document.documentElement.outerHTML`)
time.Sleep(time.Second)

// loop over all the output that came from the output channel
// and print it to the console
for len(browser.Output) > 0 {
	fmt.Println(<-browser.Output)
}

}
`

Have you tried this on your end by chance?

Thanks!

from headlesschrome.

integrii avatar integrii commented on August 28, 2024

I just tested your code snippet and didnt get any output. I turned on debugging with headlessChrome.Debug = true and still didn't get much. I then tried a variety of other javascript commands that use console.log() and window.location.href and was able to see those commands being entered into the console. I never got page content to load, though. Running as root didn't help.

I am not sure what changed here, but it does look like headless chrome isn't taking commands anymore. It would take a lot of rebuilding and testing to figure out what exactly has changed with Chrome. For now, I think this may be busted...

from headlesschrome.

sio2boss avatar sio2boss commented on August 28, 2024

Confirmed, busted...

from headlesschrome.

integrii avatar integrii commented on August 28, 2024

I tested this from the docker container example and it works. Check this: https://github.com/integrii/headlessChrome/tree/master/examples/docker

Something about the MacOS version broke... I will leave this issue open as a reminder to look into why the Mac version isn't working, but honestly Chrome changes things all the time and the constant chase may not be worth it.

I did hear that Chrome has introduced some new API for doing headless operations. Check this out: https://developers.google.com/web/tools/puppeteer/

from headlesschrome.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.