Hi rgonalo,
I have been facing some issues in Appium Grid. The hub has connected to the node properly.I have connected two devices for testing.The App has installed both devices and then stopped working.Herewith I have attached the code for reference.Please Specify me where the problem is.
import io.appium.java_client.AppiumDriver;
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 org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
public class AppiumGrid {
private AndroidDriver driver = null;
public String appionlicatPath = "E:/sample.apk";
public String MobileDevice_1 ="D1";
public String MobileDevice_2 ="D2";
public static DesiredCapabilities capabilities = new DesiredCapabilities();
AppiumDriver d1,d2;
@BeforeTest
@Parameters("Device_ID")
public void startAppium(String DeviceID) throws MalformedURLException, InterruptedException{
if(DeviceID.equalsIgnoreCase("mobile1")){
setcapabilities(appionlicatPath, MobileDevice_1,"Appium");
}
if(DeviceID.equalsIgnoreCase("mobile2")){
setcapabilities(appionlicatPath, MobileDevice_2,"Appium");
}
driver = new AndroidDriver(new URL("http://127.0.0.1:4444/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
@Test()
public void loginTest() throws InterruptedException{
Thread.sleep(1000);
{
System.out.println("Driver"+driver);
String app_package_name = "sample/id";
By userId = By.id(app_package_name + "username");
By password = By.id(app_package_name + "password");
driver.findElement(userId).sendKeys("***********************");
driver.findElement(password).sendKeys("****************);
driver.findElement(login_Button).click();
}
}
public void setcapabilities(String apppath,String device,String automation){
DesiredCapabilities capabilities1= new DesiredCapabilities();
capabilities1.setCapability("deviceName","G000H404540508AB");
capabilities1.setCapability("platformVersion", "5.1.1");
capabilities1.setCapability("udid", "G000H404540508AB");
capabilities1.setCapability("appActivity", "com.entappia.mhhs");
try {
d1 = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities1);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
System.out.println("Not able to start application");
e.printStackTrace();
}
d1.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
DesiredCapabilities capabilities2= new DesiredCapabilities();
//capabilities2.setCapability(CapabilityType.BROWSER_NAME, "Android");
capabilities2.setCapability("deviceName","G000H4045405088W");
//capabilities2.setCapability(CapabilityType.VERSION, "5.1.1");
capabilities2.setCapability("platformVersion", "5.1");
//capabilities2.setCapability(CapabilityType.PLATFORM, "ANDROID");
capabilities2.setCapability("udid", "G000H4045405088W");
try {
d2= new AndroidDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities2);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
System.out.println("Not able to start application");
e.printStackTrace();
}
d2.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
}
@AfterMethod
@ AfterTest(alwaysRun= true)
public void tearDown(){
driver.quit();
}
}
Hi @sabarinathan,
Do you have any error message? Can you provide appium logs?
Hi @suganya and @sabarinathan,
It's not possible to help you with partial screenshots, you must provide complete appium logs.
And before pasting them, please read them carefully, trying to find out at least the error message. This will help you to find out the problem and to learn more about how Appium works.
Hi,
Has anyone got this to work Appioum grid38
I have everything set up however once I run the jar file , it picks up the device but then just hangs on executing the appium and nothing happens with the phone. Any help will do.
Also when importing this into eclipse and trying to run it from the source it throws java.io.IOException: Cannot run program "adb": error=2, No such file or directory.
I did, not using anymore. You should look into https://github.com/saikrishna321/AppiumTestDistribution55
hello,
During start node server it shows a error "Syntax error in node configuration file: Unexpected token P"
srikantas-Mac-mini-3:bin RajShekhar_DiroLabs$ appium --nodeconfig /Users/RajShekhar_DiroLabs/Desktop/node1.json -p 4730
[Appium] Welcome to Appium v1.5.2
[Appium] Non-default server args:
[Appium] port: 4730
[Appium] nodeconfig: '/Users/RajShekhar_DiroLabs/Desktop/node1.json'
[Appium] Error: Syntax error in node configuration file: Unexpected token P
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at postRequest$ (lib/grid-register.js:42:12)
Can any one please suggest me how to resolve it
@bhaskar I am also facing the same issue.
is your issue resolved if yes then please guide me how to resolve this issue
I am able to run my tests in parallel on three devices but I see failures due to Explicit and Implicit wait not working on Grid, any solution for that??
see this video https://youtu.be/vXpskMkytD835