tebeka / selenium

Selenium/Webdriver client for Go
MIT License
2.53k stars 409 forks source link

go chrome selenium on VM gives EGL_NOT_INITIALIZED #316

Open phanimvs-opm opened 1 year ago

phanimvs-opm commented 1 year ago

[1689150280.783][DEBUG]: DevTools WebSocket Response: Runtime.releaseObjectGroup (id=17) (session_id=E732773EE654198B16CE196EF08F163E) FFC17A2423A5549D8A2C6F282CBFCD7A { } [1689150280.783][INFO]: [421d1d25a67b7ee706d7e8943a2023f3] COMMAND Quit { } [1689150280.833][INFO]: [421d1d25a67b7ee706d7e8943a2023f3] RESPONSE Quit [1689150280.833][DEBUG]: Log type 'driver' lost 0 entries on destruction [1689150280.833][DEBUG]: Log type 'browser' lost 0 entries on destruction MoTTY X11 proxy: Unsupported authorisation protocol [0100/000000.835551:ERROR:angle_platform_impl.cc(44)] DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1 ERR: DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1 [0100/000000.835631:ERROR:angle_platform_impl.cc(44)] Display.cpp:1064 (initialize): ANGLE Display::initialize error 12289: Not initialized. ERR: Display.cpp:1064 (initialize): ANGLE Display::initialize error 12289: Not initialized. [0100/000000.835675:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Not initialized. [0100/000000.835690:ERROR:gl_display.cc(795)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED [0100/000000.835710:ERROR:gl_display.cc(829)] Initialization of all EGL display types failed. [0100/000000.835727:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed. Post "http://localhost:4446/wd/hub/session//element": dial tcp [::1]:4446: connect: connection refused panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6eadde]

goroutine 1 [running]: main.Sensors({0x84aed0, 0xc000200360}) /diag/pvenkata/hw_diagnostics/cli/bmcsensor.go:17 +0xde main.TestWebBMC() /diag/pvenkata/hw_diagnostics/cli/bmcwebdriver.go:43 +0x3b main.main() /diag/pvenkata/hw_diagnostics/cli/main.go:588 +0xe5e [root@pvenkata-bff35y cli]# MoTTY X11 proxy: Unsupported authorisation protocol [0100/000000.934734:ERROR:angle_platform_impl.cc(44)] DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1 ERR: DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1 [0100/000000.934794:ERROR:angle_platform_impl.cc(44)] Display.cpp:1064 (initialize): ANGLE Display::initialize error 12289: Not initialized. ERR: Display.cpp:1064 (initialize): ANGLE Display::initialize error 12289: Not initialized. [0100/000000.934812:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Not initialized. [0100/000000.934837:ERROR:gl_display.cc(795)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED [0100/000000.934850:ERROR:gl_display.cc(829)] Initialization of all EGL display types failed. [0100/000000.934859:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.

phanimvs-opm commented 1 year ago

Starting ChromeDriver 117.0.5885.0 (1aef0b26535f0eba2a7d09ecd2eff12a72eb3f69-refs/heads/main@{#1169182}) on port 4446 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. [1689150280.649][INFO]: [421d1d25a67b7ee706d7e8943a2023f3] COMMAND InitSession { "capabilities": { "alwaysMatch": { "goog:chromeOptions": { "args": [ "--headless", "--no-sandbox", "--ignore-certificate-errors", "--disable-gpu" ], "binary": "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/chrome-linux/chrome", "w3c": false } } }, "desiredCapabilities": { "chromeOptions": { "args": [ "--headless", "--no-sandbox", "--ignore-certificate-errors", "--disable-gpu" ], "binary": "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/chrome-linux/chrome", "w3c": false }, "goog:chromeOptions": { "args": [ "--headless", "--no-sandbox", "--ignore-certificate-errors", "--disable-gpu" ], "binary": "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/chrome-linux/chrome", "w3c": false } } }

phanimvs-opm commented 1 year ago

func ChromeDriver() selenium.WebDriver { const ( seleniumPath = "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/selenium-server.jar" geckoDriverPath = "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/geckodriver" chromeDriverPath = "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/chromedriver" port = 4446 )

LogString("Before NewChromeDriverSerice")
service, err := selenium.NewChromeDriverService(chromeDriverPath, port, selenium.Output(os.Stderr))
if err != nil {
    LogString(err.Error())
}
defer service.Stop()

caps := selenium.Capabilities{}
caps.AddChrome(chrome.Capabilities{
   Path: "/diag/pvenkata/hw_diagnostics/cli/selenium/selenium/vendor/chrome-linux/chrome",
   Args: []string{"--headless", "--no-sandbox", "--ignore-certificate-errors", "--disable-gpu"},
})

LogString("Before NewRemote")
wd, err := selenium.NewRemote(caps, "http://localhost:4446/wd/hub")
if err != nil {
    LogString(err.Error())
}
defer wd.Quit()
return wd

}

phanimvs-opm commented 1 year ago

Any help on how to crack the issue.

go run init.go --alsologtostderr --download_browsers --download_latest E0712 13:53:06.980562 1190278 init.go:203] Unable to find the latest HTMLUnit Driver: Release for htmlunit-driver-.*-jar-with-dependencies.jar not found at http://github.com/SeleniumHQ/htmlunit-driver/releases I0712 13:53:07.392427 1190278 init.go:232] Downloading "geckodriver.tar.gz" from "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz" I0712 13:53:07.392442 1190278 init.go:232] Downloading "chromedriver.zip" from "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F1169182%2Fchromedriver_linux64.zip?generation=1689149259099994&alt=media" I0712 13:53:07.392463 1190278 init.go:232] Downloading "sauce-connect.tar.gz" from "https://saucelabs.com/downloads/sc-4.5.4-linux.tar.gz" I0712 13:53:07.392483 1190278 init.go:232] Downloading "firefox-nightly.tar.bz2" from "https://download.mozilla.org/?product=firefox-nightly-latest-ssl&os=linux64&lang=en-US" I0712 13:53:07.392451 1190278 init.go:232] Downloading "selenium-server.jar" from "https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar" I0712 13:53:07.392428 1190278 init.go:232] Downloading "chrome-linux.zip" from "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F1169182%2Fchrome-linux.zip?generation=1689149254686864&alt=media" I0712 13:53:09.567300 1190278 init.go:240] Unzipping "chromedriver.zip" I0712 13:53:09.586912 1190278 init.go:245] Unzipping "geckodriver.tar.gz" I0712 13:53:09.747064 1190278 init.go:256] Renaming "chromedriver_linux64/chromedriver" to "chromedriver" I0712 13:53:13.622433 1190278 init.go:245] Unzipping "sauce-connect.tar.gz" I0712 13:53:13.842150 1190278 init.go:256] Renaming "sc-4.5.4-linux" to "sauce-connect" I0712 13:53:14.788338 1190278 init.go:250] Unzipping "firefox-nightly.tar.bz2" I0712 13:53:28.557430 1190278 init.go:240] Unzipping "chrome-linux.zip"