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

XCUITest Element could not be found error #7009

Closed
tolgatanriverdi opened this issue Oct 13, 2016 · 7 comments
Closed

XCUITest Element could not be found error #7009

tolgatanriverdi opened this issue Oct 13, 2016 · 7 comments

Comments

@tolgatanriverdi
Copy link

tolgatanriverdi commented Oct 13, 2016

Hi

Before XCUITest (Before IOS 10)
I was using below method to find a UI Element in IOS application:

   private void executeIOSAction(IOSObjects mtosElement, ActionType actionType) throws CrashException, ActionNotPossibleException 
  {
      WebElement webElement = null;
      try {
         if (actionType == ActionType.CLICK) { // For finding clickable objects
            if (mtosElement instanceof XCUIElementTypeButton) { 
               // this.turnWifiStatus(true);
               logger.info("Clicking Button:" + mtosElement.getName() + " WithXPath:" + mtosElement.getPathStr());
               XCUIElementTypeButton buttonElement = (XCUIElementTypeButton) mtosElement;
               webElement = driver.findElement(By.xpath(buttonElement.getPathStr()));
               if (webElement != null) {
                  webElement.click();
                  buttonElement.setIsClicked();
             }
    }

But after changing implementation to XCUITest it gives the below error. Does anyone know how can I fix that?

2016-10-13 13:46:55,318 ERROR:  Web Driver Exception:An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 546 milliseconds

Path That I'm Searching: //XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeButton[1]

And this is the driver.getPageSource() output of the current Screen:

https://drive.google.com/file/d/0B3eSt3_PT8YXakQwRC1ZOHFDT2c/view?usp=sharing

Thanks

@triager triager added the Needs Triage bugs which are not yet confirmed label Oct 13, 2016
@dmydry
Copy link

dmydry commented Oct 14, 2016

Hello! I just started to test a chain appium 1.6 with ios 10 test (I had working tests with appium 1.5 and ios 9.3). I've got an issue that appium can't interact with elements in a tree with XCUIElementTypeOther. It can't find an element using xpath or accessibility id or click on it.

@srkannan
Copy link

I'm getting the same issue:
[XCUITest] Rewrote incoming selector from '//UIAApplication[1]/UIAWindow[1]/UIATextField[1]' to '//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeTextField[1]' to match XCUI type. You should consider updating your tests to use the new selectors directly

How does one find the new elements with out the Inspector tool which is not available in 1.6.0-beta3 ?

@jlipps
Copy link
Member

jlipps commented Oct 28, 2016

@srkannan for the time being, use the page source command

@sonalib10
Copy link

@jlipps I am unable to locate element appears on a video , though it has Accessibility ID , Label and Type provided. Please help.

@mayukataoka
Copy link

mayukataoka commented Feb 12, 2017

Noticed the same problem with XCUIElementTypeOther myself, also. Perhaps, it will help if we could modify the issue title to include the word "XCUIElementTypeOther"?

@mykola-mokhnach
Copy link
Collaborator

mykola-mokhnach commented Feb 12, 2017

The UI tree generated by XCTest is different from the one generated by instruments. So don't expect same paths or class names to work for both frameworks. Most of the times it is necessary to update locators according to the actual tree.
Regarding inspector - the "native" one is currently being developed. Although you can try some alternatives.

@imurchie imurchie removed the Needs Triage bugs which are not yet confirmed label Apr 13, 2017
@lock
Copy link

lock bot commented Apr 28, 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 28, 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

9 participants