There are some toggles on the app which I want to click.
So the toggle element is being clicked by appium but in actual its no effect of that click as its not enabling the toggle.
` driver.pause(5000)
console.log(“*****”+driver.getContext()) – showing native app
const toggleSwitch= await element;
await toggleSwitch.waitForDisplayed({ timeout: 5000 });
const isToggleChecked = await closeMyAccount.toggle1.getAttribute(‘checked’);
if (isToggleChecked === 'false') {
// Enable the toggle if it's currently off
await toggleSwitch.click();
console.log('Toggle has been switched on');
} else {
console.log('Toggle is already enabled');
}`
on the colnsole its printing “toggle has been switched on”. but its not working.
Log
using: 'xpath',
[0-0] value: '//android.widget.FrameLayout/android.view.ViewGroup[1]'
[0-0] }
[0-0] 2024-10-13T23:36:05.561Z INFO webdriver: RESULT {
[0-0] 'element-6066-11e4-a52e-4f735466cecf': '00000000-0000-00a8-ffff-ffff00000011',
[0-0] ELEMENT: '00000000-0000-00a8-ffff-ffff00000011'
[0-0] }
[0-0] 2024-10-13T23:36:05.568Z INFO webdriver: COMMAND getElementAttribute("00000000-0000-00a8-ffff-ffff00000011", "checked")
[0-0] 2024-10-13T23:36:05.574Z INFO webdriver: [GET] http://127.0.0.1:4723/session/d7280a90-90e8-4179-b590-ac6edcd2de90/element/00000000-0000-00a8-ffff-ffff00000011/attribute/checked
[0-0] 2024-10-13T23:36:05.594Z INFO webdriver: RESULT false
[0-0] 2024-10-13T23:36:05.596Z INFO webdriver: COMMAND findElement("xpath", "//android.widget.FrameLayout/android.view.ViewGroup[1]")
[0-0] 2024-10-13T23:36:05.597Z INFO webdriver: [POST] http://127.0.0.1:4723/session/d7280a90-90e8-4179-b590-ac6edcd2de90/element
[0-0] 2024-10-13T23:36:05.597Z INFO webdriver: DATA {
[0-0] using: 'xpath',
[0-0] value: '//android.widget.FrameLayout/android.view.ViewGroup[1]'
[0-0] }
[0-0] 2024-10-13T23:36:05.644Z INFO webdriver: RESULT {
[0-0] 'element-6066-11e4-a52e-4f735466cecf': '00000000-0000-00a8-ffff-ffff00000011',
[0-0] ELEMENT: '00000000-0000-00a8-ffff-ffff00000011'
[0-0] }
[0-0] 2024-10-13T23:36:05.648Z INFO webdriver: COMMAND elementClick("00000000-0000-00a8-ffff-ffff00000011")
[0-0] 2024-10-13T23:36:05.648Z INFO webdriver: [POST] http://127.0.0.1:4723/session/d7280a90-90e8-4179-b590-ac6edcd2de90/element/00000000-0000-00a8-ffff-ffff00000011/click
[0-0] 2024-10-13T23:36:05.695Z INFO webdriver: RESULT null
[0-0] Toggle has been switched on
and my app source is like below;
Uploading: image.png…