I am new to automation and first time trying, what is wrong with this code? Not able to use URL for appium

import static org.junit.Assert.*;

import java.io.File;

import org.junit.Test;
import org.openqa.selenium.remote.CommandExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

import com.gargoylesoftware.htmlunit.javascript.host.URL;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;

public class whatsapp {

@Test
public void  test() {
	File Appdir = new File("src");
	File app =new File(Appdir,"com.google.android.talk_v7.0.113001250-22891288_Android-4.1.apk");
	DesiredCapabilities Cap = new DesiredCapabilities();
	Cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
	Cap.setCapability(MobileCapabilityType.DEVICE_NAME,"Android Emulator");
	Cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
	
	
	AndroidDriver Driver1=new AndroidDriver(new URL("http://10.130.203.129:4327/wd/hub"), Cap);
	
}

}

is it IP of your PC where you start tests or is it another PC where Appium server is running?

in second case it is correct. in first case you need replace it to ‘localhost’ or ‘0.0.0.0’

@patelvish0 also make sure that the port that you are mentioning in the URL is the same on which your server is running…

As the default value for the port is 4723 while you have mentioned it as 4327

Your automation test will print logs in two areas:

  1. Logs will be printed by the Java process that is running your test. If there is a connection error, there would be an exception and stacktrace printed to the console (either in your IDE or on the terminal where you’re running the test).
  2. Logs will be printed by the Appium server itself. The logs are printed to the terminal or console where you’re running Appium. If Appium is running on another machine, this will occur on another machine.

In any case: post logs please! :smiley:

It is IP of my PC … so i need to use localhost as you said … Thank you. will try that. sorry for late reply. was busy with hectic office work and learning stopped in middle. will continue now.

Regards

Yup… i miss typed port number. Thank you.

I am trying to do something like this. Not sure how complicated it is or is it possible? from Android mobile app click on some link and it takes to chrome browser and then click back button to go back to app. But need to confirm that it opened ad URL on browser.