Thursday 22 September 2016

Helper methods Appium 1.6.0 Beta

  // iOS        // Find element in table cell         driver.findElementByXPath("//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='some-id']"));


        //   Print source of screen visible        System.out.println(driver.getPageSource());

        //default timeout for all commands executed using this driver. can be overridden using explicit wait        driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

        //EXPLICIT wait for element for x seconds        //  If explicit wait > implicit wait , then greater driver will default to greater wait period        int seconds= 3;
        WebDriverWait wait = new WebDriverWait(driver, seconds);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("some-id")));

//        UIAutomation(IOS)//        Find visibility of element using XPath        xpath = "UIATableCell/UIAStaticText[@label='Family'][@visible='true']";
        driver.findElementByXPath(xpath);

        click on first table cell (xpath may change based on your application)
        xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]").click

No comments:

Post a Comment