Android Open Source - androidtestdebug First Demo






From Project

Back to project page androidtestdebug.

License

The source code is released under:

MIT License

If you think the Android project androidtestdebug listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.tests;
/*from  ww  w  .  j  a  v a2 s  .  co  m*/
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class FirstDemo {
  private WebDriver driver;
  private String baseUrl;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://www.baidu.com/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testFirstDemo() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.id("kw")).click();
    driver.findElement(By.id("kw")).clear();
    driver.findElement(By.id("kw")).sendKeys("selenium");
    driver.findElement(By.id("su")).click();
  }

  @After
  public void tearDown() throws Exception {
    driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
      fail(verificationErrorString);
    }
  }

  private boolean isElementPresent(By by) {
    try {
      driver.findElement(by);
      return true;
    } catch (NoSuchElementException e) {
      return false;
    }
  }

  private String closeAlertAndGetItsText() {
    try {
      Alert alert = driver.switchTo().alert();
      if (acceptNextAlert) {
        alert.accept();
      } else {
        alert.dismiss();
      }
      return alert.getText();
    } finally {
      acceptNextAlert = true;
    }
  }
}




Java Source Code List

.????2.java
.ClbDemoClass.java
.DataDrivenDemoTest.java
.DeadLockDemo.java
.Dekker.java
.FirstDemo.java
.FirstDemo.java
.MemoryLog.java
.RaceConditionFix.java
.RaceCondition.java
.Sample1Test.java
.Sample1.java
.Sample2Test.java
.Sample2.java
.SampleSuite.java
bpdemo.BpDemo.java
bpdemo.ClbDemoClass.java
.bpdemo.java
cc.iqa.iquery.mr.By.java
cc.iqa.iquery.mr.ControlHierarchy.java
cc.iqa.iquery.mr.Plugin.java
cc.iqa.iquery.mr.QueryableDevice.java
chapter11.HelloWorld.java
com.android.example.spinner.SpinnerActivity.java
com.example.android.hcgallery.CameraFragment.java
com.example.android.hcgallery.CameraFragment.java
com.example.android.hcgallery.CameraFragment.java
com.example.android.hcgallery.CameraSample.java
com.example.android.hcgallery.CameraSample.java
com.example.android.hcgallery.CameraSample.java
com.example.android.hcgallery.ContentFragment.java
com.example.android.hcgallery.ContentFragment.java
com.example.android.hcgallery.ContentFragment.java
com.example.android.hcgallery.DirectoryCategory.java
com.example.android.hcgallery.DirectoryCategory.java
com.example.android.hcgallery.DirectoryCategory.java
com.example.android.hcgallery.DirectoryEntry.java
com.example.android.hcgallery.DirectoryEntry.java
com.example.android.hcgallery.DirectoryEntry.java
com.example.android.hcgallery.Directory.java
com.example.android.hcgallery.Directory.java
com.example.android.hcgallery.Directory.java
com.example.android.hcgallery.FitCenterFrameLayout.java
com.example.android.hcgallery.FitCenterFrameLayout.java
com.example.android.hcgallery.FitCenterFrameLayout.java
com.example.android.hcgallery.INotifyDirectoryChanged.java
com.example.android.hcgallery.INotifyDirectoryChanged.java
com.example.android.hcgallery.INotifyDirectoryChanged.java
com.example.android.hcgallery.MainActivity.java
com.example.android.hcgallery.MainActivity.java
com.example.android.hcgallery.MainActivity.java
com.example.android.hcgallery.TitlesFragment.java
com.example.android.hcgallery.TitlesFragment.java
com.example.android.hcgallery.TitlesFragment.java
com.example.tests.FirstDemo.java
.gcdemo.java
.gcdemo.java
.????.java
.???????????.java
temp.CaseErrorException.java
temp.Constants.java
temp.Login2blogTest.java
temp.UserOperationsHelper.java