Java tutorial
package mobileTests; //****************************************************************************** // //Copyright (c) 2016 Microsoft Corporation. All rights reserved. // //This code is licensed under the MIT License (MIT). // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN //THE SOFTWARE. // //****************************************************************************** import org.junit.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.CapabilityType; import io.appium.java_client.remote.MobileCapabilityType; import io.appium.java_client.remote.MobilePlatform; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.AppiumDriver; import java.io.File; import java.util.List; import java.util.concurrent.TimeUnit; import java.net.URL; import io.appium.java_client.ios.IOSDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class MobileTests { private static RemoteWebDriver MobileSession = null; private static WebElement MobileResult = null; @BeforeClass public static void setup() { try { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("app", "C:\\Program Files (x86)\\Prometheus Group\\Prometheus Mobile.MobileWin7.exe"); capabilities.setCapability("platformName", "Windows"); capabilities.setCapability("deviceName", "WindowsPC"); MobileSession = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); MobileSession.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); System.out.println("hi4"); } catch (Exception e) { e.printStackTrace(); } finally { } } /* @Before public void Clear() { MobileSession.findElementByName("Clear").click(); Assert.assertEquals("Display is 0 ", MobileResult.getText()); } @AfterClass public static void TearDown() { MobileResult = null; if (MobileSession != null) { MobileSession.quit(); } MobileSession = null; } */ @Test public void Logon() { System.out.println("hi"); Assert.assertEquals("hi", "hi"); /* MobileSession.findElementById("com.prometheusgroup.mobile:id/userName").sendKeys("QA"); MobileSession.findElementById("com.prometheusgroup.mobile:id/password").sendKeys("QAt3sting!"); MobileSession.findElementById("com.prometheusgroup.mobile:id/submitButton").click(); WebDriverWait wait = new WebDriverWait(MobileSession, 30); wait.until(ExpectedConditions.elementToBeClickable(By.className("android.widget.ImageButton"))); List<WebElement>derp = MobileSession.findElementsByClassName("android.widget.Button"); System.out.println(derp.size()); */ } }