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.

How to get deviceName value from Multicapabilities definition at run time

See original GitHub issue

Hi Team,

This might be repeated question for you guys but really I didn’t answer yet. Here is my multi-capabilities definition in protractor config file. I want to access the deviceName parameter value. How can I do it?

exports.config = {
directConnect:true,
    multiCapabilities: [
        {
            browserName: 'chrome',
            'chromeOptions': {
                'mobileEmulation': {
                    'deviceName': 'iPad'
                }
            }
        }
],

Tried under onPrepare but not giving multi-capabilities values

browser.getCapabilities().then(function(c) {
            console.log(c.get('deviceName'));
        });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
IgorSasovetscommented, Mar 2, 2018

@kat0072, please take a look at get-config-capabilities for requested example.

2reactions
IgorSasovetscommented, Feb 28, 2018

Hi, @kat0072 ! You can do it using browser.getProcessedConfig() function.

onPrepare: function() {
      return browser.getProcessedConfig().then(data => {
          console.log(data.capabilities.chromeOptions.mobileEmulation); //to print out all options
           console.log(data.capabilities.chromeOptions.mobileEmulation.deviceName); //to print out device name
      });
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get deviceName value from Multicapabilities definition ...
Fetching device name worked as advised by Gunderson but now I am running into different issue I am unable to access the variable...
Read more >
Selenium WebDriver capabilities for running tests on ...
Capability, Values. userName. For running your Selenium and Appium tests on BrowserStack it, requires a username and an access key for authenticating the ......
Read more >
Desired Capabilities in Selenium Testing With Examples
Desired Capabilities is a class used to declare a set of basic requirements such as combinations of browsers, operating systems, ...
Read more >
Capabilities and Options in Protractor - Selenium Easy
In your Protractor conf.js file, we define capabilities object and add information on which browser against Protractor should run the tests.
Read more >
SmartThings Developer Documentation
means that you execute a command, and assume it will turn on in due time, without any sort of follow up. 3.2. Important...
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