Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appium 1.7.2 unable to find element from element #10107

Closed
jamesvanhorn opened this issue Jan 31, 2018 · 3 comments
Closed

Appium 1.7.2 unable to find element from element #10107

jamesvanhorn opened this issue Jan 31, 2018 · 3 comments

Comments

@jamesvanhorn
Copy link

The problem

Calling findElementFromElement unable to find an element (confirmed element does exist using driver.getPageSource() and also running same code on Appium 1.7.1 where the code works).

Environment

  • Appium version (or git revision) that exhibits the issue: 1.7.2
  • Last Appium version that did not exhibit the issue (if applicable): 1.7.1
  • Desktop OS/version used to run Appium: Mac High Sierra
  • Node.js version (unless using Appium.app|exe): 9.4.0
  • Mobile platform/version under test: Various iOS 11 devices
  • Real device or emulator/simulator: real device
  • Appium CLI or Appium.app|exe: CLI

Details

Using the Java bindings, we are using final WebElement el = new WebDriverWait(driver, Constants.ELEMENT_WAIT, Constants.POLLING_RATE).until(ExpectedConditions.presenceOfElementLocated(locator)); to get parent, then calling
el.findElement(locator); to get child. This throws a NoSuchElementException.

What is strange is calling this as a single chain does work:
driver.findElement(locatorParent).findElement(locatorChild).click();

The only difference I can see is the WebDriverWait's ExpectedConditions is using findElements instead of findElement for finding the parent element. They both just return a single WebElement so i don't know why that would matter though. It returns the element out of the array as you will see below.

Link to Appium logs

Using Appium 1.7.1 it works: https://gist.github.com/jamesvanhorn/6966201fe9c77d49af0faf79203c5af7

Using Appium 1.7.2 it fails: https://gist.github.com/jamesvanhorn/136bed77b942d88c6c327e0e3b709d13

App under test was identical, so this seems like a WDA page source issue? I have the new capability useJSONSource=false for reference. I have also seen other issues with Appium 1.7.2 not finding view elements that I have assigned an accessibility ID to in XCode. It almost seems like there is some sort of source compression (similar to how Android can get compress or uncompressed source) occurring on real devices (simulators this doesn't happen). Setting useJSONSource=true does not help either, as I get this error facebookarchive/WebDriverAgent#797

Code To Reproduce Issue [ Good To Have ]

Doesn't happen with all findElementFromElement() calls, so difficult to give single code snippet to reproduce

@jamesvanhorn
Copy link
Author

For reference here is the page source snippet

<XCUIElementTypeCell type="XCUIElementTypeCell" name="cell_recentLocation_1" enabled="true" visible="true" x="0" y="237" width="375" height="60">
            <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="California" name="label_locationManagementRecentLocDetail" label="California" enabled="true" visible="true" x="17" y="267" width="306" height="20"/>
            <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Palo Alto" name="label_locationManagementRecentLocName" label="Palo Alto" enabled="true" visible="true" x="17" y="247" width="306" height="20"/>
            <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="0" y="296" width="375" height="1"/>
            <XCUIElementTypeButton type="XCUIElementTypeButton" name="button_locationManagementRecent" label="favoriteGrey" enabled="true" visible="true" x="331" y="245" width="44" height="44"/>
            <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="8" y="308" width="367" height="1"/>
          </XCUIElementTypeCell>

@mykola-mokhnach
Copy link
Collaborator

Duplicate of #10101

@mykola-mokhnach mykola-mokhnach marked this as a duplicate of #10101 Jan 31, 2018
@lock
Copy link

lock bot commented Apr 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants