Using Custom Desired Capabilities with Profiles

I am struggling with trying to connect my individual mobile “Profiles” to it’s own “custom” project desired capabilities settings.

Every time I try to run my test It uses the “default” Project/Desired Capabilities/Mobile/Android (property}
I want to try make it smart and use custom property.

What do i have to add to make it do that?

Hi @GeneralChingChicken,

It might be easier to set the Desired Capabilities in code, as I have found problems doing it in the settings. You can use the function RunConfiguration.setMobileDriverPreferencesProperty(key, value) to set any of the capabilities that you want. You could tie that to the values in the Profiles to dynamically populate those Desired Capabilities at run time.

Hope this helps,

Chris

@Chris_Trevarthen where would you use this function? in the “.properties” file? or within a groovy script?

Hi @GeneralChingChicken,

For starters, I would put the RunConfiguration.setMobileDriverPreferencesProperty(key, value) code in your test case file, right before the Mobile.startApplication function is called. For a further example, you can check out this post:

– Chris

1 Like

Your solution works!

1 Like

Hi Chris

How can I get the current run configuration, I have custom desired capabilities and I want to get the name of running capability, In the log, I see ‘Current run configuration: chrome_88’ but how can I get that?

INFO com.kms.katalon.core.util.KeywordUtil - [LABTEST] Current run configuration: chrome_88