I just tried with the code which launches grid and appium. Its launching appium server and its registering using nodeconfig.json. I see that the grid console shows the mobile but when AppiumDriver driver = new AppiumDriver(new ("http://local host:4444/wd/hub"),capabilities); is executed its failing...
As far as I can see; this is a Grid related issue, please make sure that you are initializing the grid connection successfully. Follow this link68 for help. Just a small question; Are you running/connecting to a virtual machine??
Hi @Hassan_Radi
I am able to see that appium is registered with the device and it is available as node at hub console...no I am not executing scripts on VM..hub , appium , and device all on local system
hi All,
package Test;
import io.appium.java_client.AppiumDriver;
import java.io.IOException;
import java.net.URL;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.exec.Executor;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class NewTrial
{
public static void main(String[] args) throws ExecuteException, IOException, InterruptedException
{
AppiumDriver driver;
DefaultExecuteResultHandler resultHandler;
DefaultExecuteResultHandler resultHandler1;
Executor executor1 ;
Executor executor ;
try{
CommandLine command1 = new CommandLine("cmd");
command1.addArgument("/c");
command1.addArgument("java -jar C:\\Users\\mkarthik\\Downloads\\selenium-server-standalone-2.41.0.jar -role hub");
resultHandler1 = new DefaultExecuteResultHandler();
executor1 = new DefaultExecutor();
executor1.setExitValue(1);
System.out.println("command: "+command1);
executor1.execute(command1, resultHandler1);
Thread.sleep(10000);
DesiredCapabilities capabilities=new DesiredCapabilities();
URL url=new URL("http://localhost:4444/wd/hub");
capabilities.setCapability(CapabilityType.VERSION, "5.0.1");
capabilities.setCapability("deviceName", "hammerhead");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("udid","085d3b920c928938");
capabilities.setBrowserName("chrome");
Thread.sleep(25000);
CommandLine command = new CommandLine("cmd");
command.addArgument("/c");
command.addArgument("C:\\Users\\mkarthik\\Documents\\selenium\\Appium\\node.exe");
command.addArgument("C:\\Users\\mkarthik\\Documents\\selenium\\Appium\\node_modules\\appium\\bin\\appium.js");
command.addArgument("--address");
command.addArgument("127.0.0.1");
command.addArgument("--port");
command.addArgument("4728");
command.addArgument("--udid");
command.addArgument("085d3b920c928938");
//command.addArgument("4724");
//command.addArgument("--chromedriver-port");
//command.addArgument("9515");
command.addArgument("--nodeconfig");
command.addArgument("C:\\Users\\mkarthik\\Desktop\\trial.json");
resultHandler = new DefaultExecuteResultHandler();
executor = new DefaultExecutor();
executor.setExitValue(1);
System.out.println("command: "+command);
executor.execute(command, resultHandler);
Thread.sleep(25000);
driver = new AppiumDriver(url, capabilities);
driver.get("http://www.google.com");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally{
}
}
}
Above code works fine...
Thanks and regards,
M.Karthik
**Hi **
I m new to Appium And I m currently working on parallel execution, I have some doubts from above comments
1. What is difference in AppiumDriver and RemoteWebDriver?
2. Which url have to provide in RemoteWebDriver ? is it hub IP with Port or Appium IP with port ?
3.appium -a http://127.0.016 -port 2734 -udid 903etg763 -bp2734 --nodeconfig "E:\Appium\Nodeconfig.json"
if i run the above command from cmd . its opening an appium with old IP and port
which i used. so i want to know is that the same happening to you . To
configure with hub , manually i m attached the Nodeconfig file in
Appium (SeleniumGridConfigurationFile).
Kindly help me to solve the issue..
I am trying to launch chrome browser on Moto x (Android kit kat) and Nexus 5(Lolipop).
Following things are done in the code:
1)Launch grid
2)I am having a dataprovider which feeds the mobile info as objects one after the other to tests I have configured the dataprovider to provide the objects parallely. Using this information i am preparing the desired capabilities which will be used for initalizing appium driver.
3)Launch appium servers as per the configuration mentioned in the dataprovider object and register it with hub
4)Execute the test.
The problem i am facing is that tests are executed in a single device but is failing when trying to execute it on another device. I am suspecting time issue or some config issue.
Can you please post the code for the above video, it would be helpful.
Thanks and regards,
Karthik
@karthik_holla,
@Srikanth_Katakam and @Appium_Master (Both are my accounts)
Whatever the test I executed using selenium grid was with Native apps/Hybrid apps. So Just now I tried with chrome browser and I was able to successfully execute the single scripts on both the devices Sequential one after another.
[I'm using Galaxy Note 2 and Galaxy Note 3 (both are in Android kit version)]
@Srikanth_Katakam @Hassan_Radi @rgonalo
@Arvind_Patel @Appium_Master
Sequential execution i am able to do. But the question is that can test scripts be executed in parallel?
As per my observation parallel execution is not happening as chromedriver was created when executing on one of the mobile, until this process is killed or exited launching of chrome on another mobile was not possible.
Please let me know if this observation is correct?? also can you help with overcoming this issue?
Thanks and regards,
M.Karthik
How to know mobile device connected as a node to the grid..pls let me know..!!! Thanks in advance @karthik_holla
@bhaskar :- You can watch my above video from 2:13.
Hi @Appium_Master,I have seen your video posted.it's a nice video... I'm trying to connect my android device to the grid..when adb connect ...it shows below error.
How can i resolve it?Please suggest me that how to connect to the grid.
Please check my video to connect device over wifi
Appium Tutorial- ADB OVER WIFI: http://youtu.be/55GxzNFpees154
it will reslove your issue
Thanks
I saw your video twice..nice video. Ya it is resolved. Thank you @Appium_Master .But I'm unable connect through Grid. it is showing error.. Could you please go through the following link,my post looks there.
Hi @Appium_Master .. Could you please give me nodeconfig.json information !!!
Thank you in advance