0
votes

I am able to inspect elements through appium using appium inspector, but the elements present on footer are not getting located due to which i am not able to get there xpath.

I tried using id fetched from source code, but again "unable to locate element" message is getting displayed when i ran my test script.

public static void main(String[] args) throws MalformedURLException, InterruptedException { AppiumDriver wd; DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("appium-version", "1.0"); capabilities.setCapability("platformName", "iOS"); capabilities.setCapability("platformVersion", "8.1"); capabilities.setCapability("deviceName", "iPhone 6"); capabilities.setCapability("app", "/Users/deepak/Library/Developer/Xcode/DerivedData/AceMobile-adoppngvthizceerrugpjdqlruyj/Build/Products/Debug-iphonesimulator/ACE Banker.app"); wd = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities); wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); Thread.sleep(10000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIATextField1")).click(); Thread.sleep(5000); ((MobileElement) wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIATextField1"))).setValue("[email protected]"); wd.findElement(By.name("Done")).click(); Thread.sleep(5000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASecureTextField1")).click(); ((MobileElement)wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASecureTextField1"))).setValue("ALMqAdmin123!"); wd.findElement(By.name("Done")).click(); //wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIAButton1")).click(); Thread.sleep(5000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIAButton1")).click(); Thread.sleep(5000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIASecureTextField1")).click(); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIASecureTextField1")).sendKeys("1111"); wd.findElement(By.name("Next")).click(); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIASecureTextField1")).click(); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIASecureTextField1")).sendKeys("1111"); wd.findElement(By.name("Done")).click(); Thread.sleep(5000);

/* Here we are sitting to scroll */

wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASwitch[8]")).click(); Thread.sleep(4000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASwitch[14]")).click(); Thread.sleep(4000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASwitch[20]")).click(); Thread.sleep(4000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASwitch[26]")).click(); Thread.sleep(4000); wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASwitch[32]")).click(); Thread.sleep(4000); //wd.findElement(By.xpath("//UIAApplication1/UIAWindow1/UIAScrollView1/UIAWebView1/UIASwitch[34]")).click(); Thread.sleep(5000);

/*After scroll this element is not getting located */ WebElement element = wd.findElement(By.id("ext-button-96"));

Above footer there is a scrollable screen.

enter image description here

Thanks

1
Why don't you scroll the list and then find rest of the locators under footer?Gaurav
Footer elements are already present, but when we scroll then also these elements are not getting located.user3817749
please post something with code to show us what exactly you are doing.Gaurav
I Have updated my question with the code, again my question is why i need to scroll if the element persists without scrolling, Element should get inspect by appium inspector. I have tried after scrolling as well but no success.Element is a background image and i am not sure whether background image gets detected by the appum or not.user3817749
Any Update on this @Gauravuser3817749

1 Answers

0
votes

Appium inspector & Ui automatorviewer will help to get the layout which is present on current android view.(all handles based on layouts).

If need to be find xpath which is not present on view try to scroll down on finding xpath,id(locators).

In scripts try to use scroll to text ot scroll to element.