[iOS] Appium returns wrong element attribute value
See original GitHub issueThe problem
I am trying to get elements attribute “value” value. At first, I print page source (pasting here just one element I am interested in):
<XCUIElementTypeSwitch type="XCUIElementTypeSwitch" value="1" name="s_settings_online_switch_value" label="Use online shopping" enabled="true" visible="true" x="349" y="385" width="51" height="32"/>
Here I clearly see that value=1. Next, I am calling GetAttribute method to find attributes “value” value. I get that value=0. Appium server log’s shows:
2019-10-23 09:27:02:394 [MJSONWP (d360e76d)] Calling AppiumDriver.getAttribute() with args: ["value","32010000-0000-0000-3607-000000000000","d360e76d-af5e-4883-87c8-4c6663172511"]
2019-10-23 09:27:02:394 [XCUITest] Executing command 'getAttribute'
2019-10-23 09:27:02:396 [WD Proxy] Matched '/element/32010000-0000-0000-3607-000000000000/attribute/value' to command name 'getAttribute'
2019-10-23 09:27:02:396 [WD Proxy] Proxying [GET /element/32010000-0000-0000-3607-000000000000/attribute/value] to [GET http://localhost:8103/session/1253BD09-66C2-47A6-91DA-FC8EEB3D47E3/element/32010000-0000-0000-3607-000000000000/attribute/value] with no body
2019-10-23 09:27:03:025 [WD Proxy] Got response with status 200: {
2019-10-23 09:27:03:026 [WD Proxy] "value" : "0",
2019-10-23 09:27:03:026 [WD Proxy] "sessionId" : "1253BD09-66C2-47A6-91DA-FC8EEB3D47E3"
2019-10-23 09:27:03:026 [WD Proxy] }
2019-10-23 09:27:03:026 [MJSONWP (d360e76d)] Responding to client with driver.getAttribute() result: "0"
I have encountered this after updating Appium from 1.14.2 to 1.15.1.
Environment
- Appium version (or git revision) that exhibits the issue: 1.15.1
- Last Appium version that did not exhibit the issue (if applicable): 1.14.2
- Desktop OS/version used to run Appium: macOS Mojave 10.14.6
- Node.js version (unless using Appium.app|exe): 10.16.3
- Npm or Yarn package manager: 6.9.0
- Mobile platform/version under test: iOS 11.0.3
- Real device or emulator/simulator: real device iPhone 6s+
- Appium CLI or Appium.app|exe: 1.15.1
Code To Reproduce Issue [ Good To Have ]
Something like this:
var state = element.GetAttribute("value");
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
getting wrong attribute value for 'XCUIElementTypeSwitch ...
Hi, I'm using real iOS devices for testing and i have several 'XCUIElementTypeSwitch' toggles in my app, to change state of these toggles ......
Read more >iOS: getAttribute("value") works for some elements, returns ...
I am getting inconsistent results with the getAttribute() method when trying to retrieve the “value” attribute. Environment. Appium server ...
Read more >iOS isDisplayed() returns false when element is visible
I am automating an iOS app. I have an element, let's call it 'valueElement'. I want to get its value attribute so I...
Read more >IOS click request is being sent but another element is being ...
I am locating an element using POM appium annotations (@iOSXCUITFindBy annotation). Then, waiting for it to be clickable using WebDriverWait and ...
Read more >Visible attribute is false in appium inspector even-though UI ...
In iOS app even-though UI elements are displayed (could see manually) ,value of visible attribute in Appium inspector is false. why so and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In case someone is not aware, to get around this issue you can install both xcode 11.1 (for iOS 13 automation only) and xcode 10.x (for iOS 12 and below) on your machine. So depending on which automation to run you can switch the context on which xcode SDK to use. Please see below link:
http://appium.io/docs/en/advanced-concepts/multiple-xcode-versions/
Closed as third party value