0
votes

I am having a really hard time understanding the following problem, i have an app, i use appium inspector to see the elements, but when i use the elements, i get that the element is not found, therefore i printed the code using the driver.getPageSource() method, and i realized that the xml code that is created while running the app, is actually different to what appium inspector sees, what is the problem and how can it be solved? i could ask to the developers to fix it once i know the root cause, thanks in advance.

This is an example of a difference

Under < XCUIElementTypeOther name = Picture, Left Rear Corner> there are 4 more elements 2 StaticText, 2 Buttons (appium inspector) and on the the same element but in the java console, there are only 2 tags, so i do not see the 2 static text and the 2 buttons (which is what i want to click)

enter image description here

enter image description here

As you can see the code in the console is different to what i see in appium iinspector. this is for IOS app.

 while (driver.findElementsById("Additional Videos").size() == 0) {
            swipeScreenDown();
        }
        driver.getPageSource();
        WebElement additionalVideos = driver.findElementByXPath("//XCUIElementTypeOther[@name=\"Picture, Left Front Corner\"]");
        driver.getPageSource();
      List<WebElement> idf = additionalVideos.findElements(By.className("XCUIElementTypeButton"));
        driver.getPageSource();
        System.out.println(idf.size());
        driver.getPageSource();
        idf.get(0).click();
        driver.getPageSource();

Error got:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
1
It is difficult to view screenshots of code. Can you at least tell us what differences you see? - Greg Burghardt
Under <XCUIElementTypeOther name = Picture, Left Rear Corner> there are 4 more elements 2 StaticText, 2 Buttons (appium inspector) and on the the same element but in the java console, there are only 2 <XCUIElementTypeOther> tags, so i do not see the 2 static text and the 2 buttons (which is what i want to click) - Adrian Jimenez
Please put this information in your question. It is difficult for people to read this kind of stuff in comments - Greg Burghardt

1 Answers

0
votes

PageSource() action can print the visual elements at the screen.

As per my understanding, You are currently performing PageSource() action when loading the screen.

You need to click at the selected element enter image description here

After click on this element use PageSource() action. You get that element in the log of the PageSource().