Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make selenium-side-runner run headless? #300

Closed
cemol opened this issue Jul 12, 2018 · 12 comments
Closed

How to make selenium-side-runner run headless? #300

cemol opened this issue Jul 12, 2018 · 12 comments

Comments

@cemol
Copy link

cemol commented Jul 12, 2018

Meta -

OS: Windows 10
Selenium IDE Version: v3.2.0-beta.1
Selenium SIDE Runner Version: 3.2.0-beta.1
Node version: npm: 5.6.0, node: v8.11.3
Browser: Chrome

Browser Version:

Expected Behavior -

Is there a way to run selenium-side-runner headless?
Like:

selenium-side-runner --headless chrome project.side

Actual Behavior -

Steps to reproduce -

@corevo
Copy link
Member

corevo commented Jul 12, 2018

selenium-side-runner -c "chromeOptions.args=[headless]" project.side

@corevo corevo closed this as completed Jul 12, 2018
@cemol
Copy link
Author

cemol commented Jul 12, 2018

Thank you!

@limasigor2
Copy link

limasigor2 commented Dec 4, 2018

@corevo is there any way that I can use firefox headless?

@Yrds
Copy link

Yrds commented Dec 4, 2018

@limasigor2 This can be achieved by set the env MOZ_HEADLESS=1 before run selenium-side-runner

It work but i didn't any further tests

@corevo
Copy link
Member

corevo commented Dec 4, 2018

I rather figure out a way of doing it using the capabilities, so that the .side.yml can consolidate all that info.
It's a matter of parsing it to the js bindings, I'll look into it.
EDIT: it should be possible right now, using capabilities, I just don't know from the top of my head which one to pass.

@Bsterzen
Copy link

Thanks for the great tool. I have it doing exactly what I need - but - I've been unable to set the Chrome default download directory. I'm pretty sure it's a prefs settings, but I can't seem to find the right combination to make it work. Here is what I'm using:

selenium-side-runner -c "chromeOptions.prefs=[{browser.download.manager.showWhenStarting=false, safebrowsing.enabled=false, browser.helperApps.neverAsk.saveToDisk=application/download, application/octet-stream, text/csv, application/vnd.ms-excel, application/msexcel, application/x-msexcel, application/excel, application/pdf, safebrowsing-disable-download-protection=true, download.default_directory=G:\Downloads\SideRunner}]" E:\ESPOcho5.side

I'd also be fine with setting this in a file somewhere, but I haven't been able to figure out how to use the side.yml file (format) for this.

I'd appreciate any pointers

Thanks!

Bill

@mirao
Copy link

mirao commented Feb 23, 2019

@Yrds: Confirmed, the command

MOZ_HEADLESS=1 selenium-side-runner -c "browserName=firefox" project.side

works for me.

Another way (found here) is

selenium-side-runner -c "browserName=firefox moz:firefoxOptions.args=[-headless]" project.side

Note there must be "-" in argument.

BTW I tried some tests and must say that headless mode speeds up testing much more in Chrome than in Firefox. In Firefox there is almost no performance difference between headless and non-headless mode.

@vlad-bordei
Copy link

When I run
selenium-side-runner -c "chromeOptions.args=[headless]" myproject.side
the following error occur:

Test suite failed to run
   TypeError: Target browser must be a string, but is <undefined>; did you forget to call forBrowser()?

     at Builder.build (../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/index.js:574:13)
     at buildDriver (../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/jest-environment-selenium/dist/index.js:65:17)
     at WebdriverEnvironment.setup (../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/jest-environment-selenium/dist/index.js:36:32)

What I do wrong?
chromedriver 2.46

In non-headless mode tests are running fine.

@mirao
Copy link

mirao commented Feb 27, 2019

@vlad-bordei Run it with option browserName=chrome:

$ selenium-side-runner -c "browserName=chrome chromeOptions.args=[disable-infobars, headless]" myproject.side

@vlad-bordei
Copy link

Thanks @mirao

It works. Thanks!

@jonclawsonMeasurabl
Copy link

I get the following error when I run this command on headless ubuntu 18
selenium-side-runner -c "browserName=chrome chromeOptions.args=[headless, no-sandbox, disable-dev-shm-usage, disable-infobars] chromeOptions.binary='/usr/bin/google-chrome-stable'" siteTest.side

`Test suite failed to run

WebDriverError: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)`

@caractacus
Copy link

Headless from Chrome75:

selenium-side-runner -c "goog:chromeOptions.args=[--headless,--nogpu] browserName=chrome"

@lock lock bot locked and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants