Skip to content

Instantly share code, notes, and snippets.

@aluedeke
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aluedeke/f3d7d4c934600954f323 to your computer and use it in GitHub Desktop.
Save aluedeke/f3d7d4c934600954f323 to your computer and use it in GitHub Desktop.
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.net.MalformedURLException;
import java.net.URL;
/**
* Created by aluedeke on 10/03/15.
*/
public class SampleTest {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
// capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "Android");
// capabilities.setCapability("platformVersion", "4.4");
// capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("testobject_api_key", "BB2EE4D9F06345CE8602F2B2D73ACABC");
capabilities.setCapability("testobject_app_id", "1");
capabilities.setCapability("testobject_device", "Sony_Xperia_T_real");
capabilities.setCapability("testobject_suite_name", "Citrix Regression Tests");
capabilities.setCapability("testobject_test_name", "Attendee login");
AppiumDriver wd = new AndroidDriver(new URL("https://app.testobject.com:443/api/appium/wd/hub"), capabilities);
WebDriver driver = new Augmenter().augment(wd);
try{
new WebDriverWait(wd, 60).until(ExpectedConditions.visibilityOfElementLocated(By.id("com.citrixonline.android.gotomeeting:id/JoinMeetingId"))).sendKeys("490-071-053");
((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
new WebDriverWait(wd, 60).until(ExpectedConditions.visibilityOfElementLocated(By.id("com.citrixonline.android.gotomeeting:id/JoinMeetingButton"))).click();
((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
new WebDriverWait(wd, 60).until(ExpectedConditions.invisibilityOfElementLocated(By.className("android.widget.ProgressBar")));
// new WebDriverWait(wd, 60).until(ExpectedConditions.visibilityOfElementLocated(By.id("com.citrixonline.android.gotomeeting:id/Prompt_User_Info_Name"))).sendKeys("Hannes Lenke");
((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
new WebDriverWait(wd, 60).until(ExpectedConditions.visibilityOfElementLocated(By.id("com.citrixonline.android.gotomeeting:id/Prompt_User_Info_Save"))).click();
((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
Thread.sleep(5000);
} finally {
wd.quit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment