[Appium 1.15] - getting wrong attribute value for 'XCUIElementTypeSwitch' element

Hi, I’m using real iOS devices for testing and i have several ‘XCUIElementTypeSwitch’ toggles in my app, to change state of these toggles I’ve used next method: driver.findElement(MobileBy.AccesibilityId(‘toggleId’)).getAttrinute(‘value’), if it’s equals to 1 then toggle is enabled and vice versa. But now I’m always getting 0, it doesn’t depend on toggle state, therefore, when I’m trying to check this element using Appium desktop or getting page source I can see correct value!

It used to work before update to Appiun 1.15 and iOS 13, this is important!

Can someone help me to solve this ‘getAttribute()’ method issue please???

1 Like

Does includeNonModalElements help in your case?

If it works Appium 1.15, Xcode 10.3 and iOS 12, the root cause could be iOS 13 or Xcode 11’s XCTest framework side.

I have similar issue. I can not get “value” from found element. I wait when test application will be released on xcode 11. Now i have workaround, before i want to get value from element i have to finds all textfilde elements

driver.findElements(By.className(“XCUIElementTypeTextField”));
element.getAttribute(“value”);

what is xcode version, your ios developers, use to release application? I do not know why but there is any connection between xcod use to release application and xcode you are use to tests.

Same issue here.

our page source shows value = 1 and when we try: find_element_by_ios_predicate(‘wdName =“Wi-Fi” and wdType=“XCUIElementTypeSwitch”’).get_attribute(‘value’)

we get 0 :frowning:

1 Like

Have the same issue.
loginScreen.setUpFeatureFlagsForm().mainScreenViper().getValue() always gets 0 value.
mainScreenViper locator is MobileBy.iOSNsPredicateString("type = 'XCUIElementTypeSwitch' AND name = 'mainScreenVIPER'")
getValue() always returns 0 value despite of switcher position (turn on or turn off). Problem came after Appium version update to 15.1 version.
Can someone provide any solution for this issue?