in my appium studio not install an app in an emulator
Please paste your code in which you have used in your IDE, I would like to know how emulator is being used in your code
package Testing;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
//import org.testng.annotations.AfterMethod;
//import org.testng.annotations.BeforeMethod;
//import org.testng.annotations.Test;
import org.openqa.selenium.remote.RemoteWebElement;
@Test
public class FavoritesCases {
private AndroidDriver driver;
@BeforeMethod
public void setUp() throws MalformedURLException {
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(“platformName”, “Emulator”);
desiredCapabilities.setCapability(“platformversion”, “5.0.2”);
desiredCapabilities.setCapability(“deviceName”, “emulator-5554”);
desiredCapabilities.setCapability("app", "D:\\App\\app-release_2_24_95_prod.apk");
desiredCapabilities.setCapability("appPackage", "com.mobile.producersonline");
desiredCapabilities.setCapability("appActivity", "com.mobile.producersonline.SplashActivity");
URL remoteUrl = new URL("http://localhost:4723/wd/hub");
driver = new AndroidDriver(remoteUrl, desiredCapabilities);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
driver.hideKeyboard();
driver.hideKeyboard();
driver.hideKeyboard();
}
// private void setCapability(String string, String string2) {
// TODO Auto-generated method stub
//}
public void AddonFavorites() throws InterruptedException {
//enter valid user id
MobileElement Userid = (MobileElement) driver.findElementById("com.mobile.producersonline:id/edtEmailOrPhone");
Userid .sendKeys("919182985239");
Thread.sleep(1000);
//enter valid password
MobileElement Password = (MobileElement) driver.findElementById("com.mobile.producersonline:id/edtPassword");
Password.sendKeys("12345"); Thread.sleep(1000);
driver.hideKeyboard();
driver.hideKeyboard();
driver.scrollTo("R");
//click on submit button
MobileElement Signinbtn = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnSignIn");
Signinbtn.click(); Thread.sleep(1000);
//click on allow msg
MobileElement Allowbtn = (MobileElement) driver.findElementById("com.android.packageinstaller:id/permission_allow_button");
Allowbtn.click(); Thread.sleep(5000);
//click on heart symbol
MobileElement el2 = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnFavorite");
el2.click();Thread.sleep(1000);
//click on ok button
MobileElement el3 = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnInfoOk");
el3.click();Thread.sleep(1000);
// MobileElement el4 = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnFavorite");
// el4.click();Thread.sleep(1000);
}
public void RomoveonFavorites() throws InterruptedException {
//enter valid user id
MobileElement Userid = (MobileElement) driver.findElementById("com.mobile.producersonline:id/edtEmailOrPhone");
Userid .sendKeys("919182985239");
Thread.sleep(1000);
//enter valid password
MobileElement Password = (MobileElement) driver.findElementById("com.mobile.producersonline:id/edtPassword");
Password.sendKeys("12345"); Thread.sleep(1000);
driver.hideKeyboard();
driver.hideKeyboard();
driver.scrollTo("R");
//click on submit button
MobileElement Signinbtn = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnSignIn");
Signinbtn.click(); Thread.sleep(1000);
//click on allow msg
MobileElement Allowbtn = (MobileElement) driver.findElementById("com.android.packageinstaller:id/permission_allow_button");
Allowbtn.click(); Thread.sleep(5000);
//click on heart symbol
MobileElement el1 = (MobileElement) driver.findElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.view.ViewGroup/android.widget.LinearLayout[2]/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.ImageButton");
el1.click(); Thread.sleep(2000);
MobileElement el3 = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnInfoOk");
el3.click();Thread.sleep(1000);
}
public void OpenFovoritesPage() throws InterruptedException {
//enter valid user id
MobileElement Userid = (MobileElement) driver.findElementById("com.mobile.producersonline:id/edtEmailOrPhone");
Userid .sendKeys("919182985239");
Thread.sleep(1000);
//enter valid password
MobileElement Password = (MobileElement) driver.findElementById("com.mobile.producersonline:id/edtPassword");
Password.sendKeys("12345"); Thread.sleep(1000);
driver.hideKeyboard();
driver.hideKeyboard();
driver.scrollTo("R");
//click on submit button
MobileElement Signinbtn = (MobileElement) driver.findElementById("com.mobile.producersonline:id/btnSignIn");
Signinbtn.click(); Thread.sleep(1000);
//click on allow msg
MobileElement Allowbtn = (MobileElement) driver.findElementById("com.android.packageinstaller:id/permission_allow_button");
Allowbtn.click(); Thread.sleep(5000);
//click on navigation button
MobileElement navigate = (MobileElement) driver.findElementByAccessibilityId("Open navigation drawer");
navigate.click(); Thread.sleep(1000);
//click on Favorites
MobileElement Favorites = (MobileElement) driver.findElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.support.v7.widget.LinearLayoutCompat[5]/android.widget.CheckedTextView");
Favorites.click(); Thread.sleep(1000);
}
private void threed(int i) {
// TODO Auto-generated method stub
}
@AfterMethod
public void tearDown() {
driver.quit();
}
}
Can you replace your code from
desiredCapabilities.setCapability(“deviceName”, “emulator-5554”);
to
dc.setCapability(“deviceQuery”, “(@serialnumber=‘emulator-5554’) and (@emulator=‘true’)”);
this code is showing error
Please paste the code after that change and the error, else it will be difficult to troubleshoot
[quote=“kishore, post:4, topic:1594”]
dc.setCapability(“deviceQuery”, “(@serialnumber=‘emulator-5554’) and (@emulator=‘true’)”);
[/quote]
It will work please try to resolve the enclosing as double codes as below.
dc.setCapability(“deviceQuery”, “(@serialnumber=‘emulator-5554’) and (@emulator=‘true’)”);
Please do not copy as is , please try to resolve the with correct parenthesis but the idea the above solution gives you an idea.
FAILED CONFIGURATION: @BeforeMethod setUp
org.openqa.selenium.SessionNotCreatedException: session not created (Exception while compiling xpath Lock Device by query: (@serialnumber=‘emulator-5554’) and (@emulator=‘true’) ) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 12.61 seconds
Build info: version: ‘2.45.0’, revision: ‘5017cb8’, time: ‘2015-02-26 23:59:50’
System info: host: ‘DESKTOP-GHH97TE’, ip: ‘192.168.1.9’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_201’
Driver info: io.appium.java_client.android.AndroidDriver
i am facing this error
Please make sure the Emulator is detected in is “ready” state in the Appium Studio
Did this problem get solved ? As far as I know this problem is because of deviceQuery if emulator is in Ready state
emulator is “ready” state is showing
I will mail you to your mail address , please mail me the log as an reply.
please send me your mail
I get
Address not found
Your message wasn’t delivered to sidhir.yalla92@gmail.com because the address couldn’t be found, or is unable to receive mail.
LEARN MORE