In latest Chrome version there is an option to run chrome with -headless flag. Why not add this feature to selenide to get rid of Xvfb during tests
You are able to run tests in headless chrome now, just set chrome options
Selenide uses it's own Driver Management out of the box, so why not implement it in Configuration class like Configuration.browser = "chrome-headless";
Otherwise you need to create your own chromedriver and insert in WebDriverRunner or something like that
Nope, you jut need to say gradlew test -Dchromeoptions.args="--headless --disble-gpu".
Several days ago I've submited PR https://github.com/codeborne/selenide/pull/556 that allows to
set capabilities incliding firefox profiles and chrome options via Configuration.browserCapabilties = caps
@SergeyPirogov any chance to run it headless with maven?
Chrome still runs in gui mode when I use mvn test -Dchromeoptions.args="--headless --disble-gpu"
Linux x64
ChromeDriver 2.30.477691
upd:
I finally ran it using mvn test -Dchromeoptions.args=headless (for some reason it's the only way it works for me)
When I execute with -Dchromeoptions.args="--headless --disble-gpu", it seems to hang at some point.
Gradle Test Executor 1 > com.nhnent.tc.console.ui.BasicCheck STANDARD_ERROR
7์ 31, 2017 12:25:58 ์คํ com.codeborne.selenide.impl.WebDriverThreadLocalContainer closeWebDriver
์ ๋ณด: Close webdriver: 12 -> ChromeDriver: chrome on XP (27a2ae9866dfcc5cc07ebc74e669edce)
7์ 31, 2017 12:25:58 ์คํ com.codeborne.selenide.impl.WebDriverThreadLocalContainer$CloseBrowser run
์ ๋ณด: Trying to close the browser ChromeDriver ...
7์ 31, 2017 12:25:59 ์คํ com.codeborne.selenide.impl.WebDriverThreadLocalContainer closeWebDriver
์ ๋ณด: Closed webdriver in 969 ms
Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 25077
Only local connections are allowed.
7์ 31, 2017 12:26:01 ์คํ org.openqa.selenium.remote.ProtocolHandshake createSession
์ ๋ณด: Detected dialect: OSS
7์ 31, 2017 12:26:01 ์คํ com.codeborne.selenide.webdriver.WebDriverFactory adjustBrowserSize
์ ๋ณด: Set browser size to 1920x1280
7์ 31, 2017 12:26:02 ์คํ com.codeborne.selenide.webdriver.WebDriverFactory createWebDriver
์ ๋ณด: BrowserName=chrome Version=60.0.3112.78 Platform=XP
7์ 31, 2017 12:26:02 ์คํ com.codeborne.selenide.webdriver.WebDriverFactory createWebDriver
์ ๋ณด: Selenide v. 4.5.1
7์ 31, 2017 12:26:02 ์คํ com.codeborne.selenide.webdriver.WebDriverFactory createWebDriver
์ ๋ณด: Selenium WebDriver v. 3.4.0 build time: unknown
7์ 31, 2017 12:26:02 ์คํ com.codeborne.selenide.impl.WebDriverThreadLocalContainer createDriver
์ ๋ณด: Create webdriver in current thread 12: ChromeDriver -> ChromeDriver: chrome on XP (5131c2aee01c7863da328638eca1a63f)
// No progress
Executing headless Chrome is successful.
$ chrome --headless --disable-gpu --print-to-pdf https://www.google.com/
[0731/115014.872:INFO:headless_shell.cc(464)] Written to file output.pdf.
KLIB_SelfTest return : KLR_OK
Yes, because --headless, --disable-gpu is used for command line, but in Selenium you should use headless and disable-gpu. It's because in source code it workds like this
chromeOptions.addArguments("headless","disable-gpu")
@SergeyPirogov
What should I do to run tests in headless Chrome in Windows?
You mean that the command line is not right way?
My full command line is like.
gradle clean test -Palpha --tests=*.BasicCheck -Dchromeoptions.args="--headless --disable-gpu"
Since selenide 4.8 you can run Chrome and Firefox in headless mode using the headless parameter.
In code:
Configuration.headless = true.
Using parameters:
-Dselenide.headless=true
Yep. thank you @ostap-oleksyn
Please note that chromeoptions.args expects all arguments to be comma separated.
-Dchromeoptions.args=--headless,--disable-gpu,--no-sandbox
Most helpful comment
Nope, you jut need to say gradlew test -Dchromeoptions.args="--headless --disble-gpu".
Several days ago I've submited PR https://github.com/codeborne/selenide/pull/556 that allows to
set capabilities incliding firefox profiles and chrome options via Configuration.browserCapabilties = caps