hai ram…thnx for the reply…
i am done with the issue…
i have resolved the issue using the code…
import io.appium.java_client.android.AndroidDriver;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
//import net.sourceforge.htmlunit.corejs.javascript.ast.WhileLoop;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.*;
public class Ecom_mobile_App_guru {
AndroidDriver driver;
WebElement element;
@BeforeClass
public void setUp() throws MalformedURLException, InterruptedException{
//Set up desired capabilities and pass the Android app-activity and app-package to Appium
File app = new File(
"C:\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools\\EcBuy.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","emulator-5554");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformversion", "5.0.1");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.orgname.EcBuy");
capabilities.setCapability("appActivity", "com.orgname.EcBuy.EcBuy");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
while(true)
{
if(findElement())
{
break;
}
else
{
driver.swipe(33, 1080, 767, 313, 1000);
}
}
element.click();
}
@Test
public void testcase1() throws MalformedURLException, InterruptedException {
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
boolean findElement()
{
try {
if((element =driver.findElementByName("Wearable Technology")) != null)
{
return true;
}
else
{
return false;
}
} catch (Exception e) {
// TODO: handle exception
return false;
}
}
}