question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass browser parameter through command line

See original GitHub issue

Hi,

I am using multiCapabilities for multiple browsers in config.js file as below,

 multiCapabilities: [ 
        {
          'browserName': 'chrome',
          'chromeOptions': {
          'prefs': {
              // disable chrome's annoying password manager
              'profile.password_manager_enabled': false,
              'credentials_enable_service': false,
              'password_manager_enabled': false
            } 
          }
   
        } ,
         
        {
            browserName : 'firefox',
            marionette : true,
            acceptInsecureCerts : true,
            firefoxOptions:{
                args: ['--headless']
            },
            'moz:firefoxOptions': {
                args: [ '--headless' ]
            }    
        }
    ]

but instead of executing tests on multiple browsers, I want to make it parameterized like, whatever the browser name I’ll pass from command line only that browser should work.

So, is there a way we can pass specific browser name through protractor command line?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

3reactions
raj8githubcommented, Aug 16, 2018

@bharukaRupesh more info on process.argv can be found here… https://nodejs.org/docs/latest/api/process.html#process_process_argv

Just run protractor conf.js and console.log(process.argv). you will understand whats happening when you pass any parameters in addition to protractor conf.js those are also captured as part of process.argv and its an array. This holds good for any node js program invocation.

Protractor itself provides few options you could use with “–”. Check below. you could try using --browser / --capabilities.* param.

image

2reactions
raj8githubcommented, Aug 16, 2018

@bharukaRupesh very simple example…

you could get more creative with this… also you can check the browser parameter and populate other capabilities as well…

image

Let me know if you need more details.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I pass browser as a command line parameter when ...
So I would like to pass into test a command line parameter --browser chrome for example and have it only run the chrome...
Read more >
How to pass command-line arguments to the browser?
With Kameleo, you can fine-tune the browsers by passing command-line arguments. The arguments are passed either by using the ...
Read more >
Send parameters from command line to selenium project
This video will explain how to send parameters or values like browser name, environment, username, password etc to your selenium framework.
Read more >
Fetch data from pytest command line arguments ... - YouTube
This video will explain how to fetch the pytest command line parameters and use in selenium python framework.We will parse the parameters ......
Read more >
Command Line Arguments in Python - GeeksforGeeks
Using getopt module · Syntax: getopt. · Parameters: · args: List of arguments to be passed. · options: String of option letters that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found