I am using wdio with appium for native app automation for both Android and iOS platforms
I want to set some custom cookie into my native app for automation
but I dont have access to modify the native app data
- Approach -1
tried to use browser.setCookies() method
await browser.setCookies(
{
name: 'NativeAppcookie',
value: 'Cookie_value',
secure: true,
})
but I am getting error
WARN webdriver: Request failed with status 405 due to Method is not implemented
but browser.setCookies() works for mobile browser as expected and facing issue only with mobile native app
- Approach -2
added custom data to the appium capability
capabilities: {
platformName: 'iOS',
platformVersion: '14.5',
deviceName: 'iPhone 12',
app: '/path/to/your/app',
automationName: 'XCUITest',
'appium:customData': {
'cookies': [
{
name: 'cookie_name',
value: 'cookie_value',
path: '/',
domain: 'test_domain.com',
secure: true
},
]
}
}
but the expected behaviour for setting the cookie is not seen when I launch the native application
suresh dharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.