Eclipse console returns blank

Hello Team.
Here is my code, which appears to be correct, but the console is not reporting anything (blank white screen) and I am unable to launch my application. Please assist.

package resourceapp;

import javax.print.DocFlavor.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;



public class Launchapp {

	static AppiumDriver driver;
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
	
	public void Openapp() {
		DesiredCapabilities cap = new DesiredCapabilities();
		
		cap.setCapability("deviceName", "Realme C21"); 
		cap.setCapability("udid", "TS5HAEEMDYAUVKRS");
		cap.setCapability("platformName", "Android");
		cap.setCapability("platformVersion", "11.0.0");
		cap.setCapability("appPackage", "com.loyaltyhub");
		cap.setCapability("appActivity", "com.loyaltyhub.MainActivity");
		
			URL url = new URL("http://127.0.0.1:4723/wd/hub");
			driver = new AppiumDriver(cap);
			System.out.println("Application started");
			
			driver.findElement(By.className("android.widget.EditText")).sendKeys("2354654323");
			driver.findElement(By.className("android.view.ViewGroup")).click();
			driver.findElement(By.className("android.widget.Button")).click();
			driver.findElement(By.className("android.widget.EditText")).sendKeys("123456");
			System.out.println("Successfully launched app");

			driver.quit();
	}

}

Sounds like an Eclipse issue:

1 Like

@wreed well in that case it should not work for other project too right? but my rest of the project without any issues. only happens with Appium codes. Please help

You are running appium client inside of eclipse? Does the server run in the same console runspace? What sounds like a dodgy thing, could you try start the server in another runspace to remove console hooking problems?

1 Like

I agree. If the IDE is not working, try from the terminal. There is nothing in your Appium code that will break Eclipse. Looks very standard.

However, blank console in Eclipse is a major problem:
https://duckduckgo.com/?q="eclipse"+"blank+console"&atb=v314-1&ia=web

2 Likes

Thank you @wreed and @Conrad_Braam I have tried to resolve the blank issues by adding try catch block to the URL. But now am getting org.openqa.selenium.SessionNotCreatedException: error message ie. timeout message even though my real device configuration are correct. Could you please help me to resolve the issues? (Note: Also I’ve tried to change the URL to 127.0.0.01:4723 but no luck.

Code:
package resourceapp;

import java.net.MalformedURLException;

import javax.print.DocFlavor.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;

public class Launchapp {

	static AppiumDriver driver;

	public static void main(String[] args) throws MalformedURLException {

		DesiredCapabilities cap = new DesiredCapabilities();

		cap.setCapability("deviceName", "Realme C21");
		cap.setCapability("udid", "TS5HAEEMDYAUVKRS");
		cap.setCapability("platformName", "Android");
		cap.setCapability("platformVersion", "11.0");
		cap.setCapability("appPackage", "com.loyaltyhub");
		cap.setCapability("appActivity", "com.loyaltyhub.MainActivity");

		try {
			URL url = new URL("http://127.0.0.1:4723/wd/hub");
		} catch (Exception ex) {
			//
		}

		driver = new AppiumDriver(cap);
		System.out.println("Application started");

		driver.findElement(By.className("android.widget.EditText")).sendKeys("2354654323");
		driver.findElement(By.className("android.view.ViewGroup")).click();
		driver.findElement(By.className("android.widget.Button")).click();
		driver.findElement(By.className("android.widget.EditText")).sendKeys("123456");
		System.out.println("Successfully launched app");

		driver.quit();
		return;
	}

}

Console Error message:
e[35m[Appium]e[39m Welcome to Appium v1.22.2
e[35m[Appium]e[39m Appium REST http interface listener started on 0.0.0.0:4723
Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: ‘4.3.0’, revision: ‘a4995e2c09*’
System info: host: ‘KS-SUHAS-PC’, ip: ‘192.168.0.103’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘11.0.12’
Driver info: io.appium.java_client.AppiumDriver
Command: [null, newSession {capabilities=[{appium:appActivity=com.loyaltyhub.MainActivity, appium:appPackage=com.loyaltyhub, appium:deviceName=Realme C21, platformName=ANDROID, appium:platformVersion=11.0, appium:udid=TS5HAEEMDYAUVKRS}], desiredCapabilities=Capabilities {appActivity: com.loyaltyhub.MainActivity, appPackage: com.loyaltyhub, deviceName: Realme C21, platformName: ANDROID, platformVersion: 11.0, udid: TS5HAEEMDYAUVKRS}}]
Capabilities {}
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:587)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:224)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:179)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:79)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:98)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:123)
at resourceapp.Launchapp.main(Launchapp.java:32)
Caused by: io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: C:\Program Files\nodejs\node.exe Arguments: [C:\Users\GSPLKLPA196\AppData\Roaming\npm\node_modules\appium\build\lib\main.js, --port, 4723, --address, 0.0.0.0]
Process output: e[35m[Appium]e[39m Welcome to Appium v1.22.2
e[35m[Appium]e[39m Appium REST http interface listener started on 0.0.0.0:4723

at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:190)
at io.appium.java_client.remote.AppiumCommandExecutor.lambda$execute$2(AppiumCommandExecutor.java:172)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:170)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
... 6 more

Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://127.0.0.1:4723/status] to be available after 20006 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:89)
at io.appium.java_client.service.local.AppiumDriverLocalService.ping(AppiumDriverLocalService.java:155)
at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:177)
… 10 more
Caused by: java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:87)
… 12 more

Appium Logs:
[debug] [HTTP] No route found for /status
[HTTP] <-- GET /status 404 7 ms - 211
[HTTP]
[HTTP] --> GET /status
[HTTP] {}
[debug] [HTTP] No route found for /status
[HTTP] <-- GET /status 404 8 ms - 211

Can you give more info on what you are doing here? You have Appium v1.22.2, but then there is a screenshot of Appium Desktop v1.15.1. Why not use the same versions?

@wreed well, I tried with appium version v1.15.1 but same error been seen. Please help

You haven’t really explained what you are doing so I’m just going to tell you what I see from your screenshots. It looks like you:

  1. Start Appium Desktop v1.15.1 Server
  2. Attempt to start Appium Server v1.22.2 from IDE (Eclipse)

You get an error that Server is already running. What happens if you don’t start Desktop before you run IDE?

Please correct me if I’m seeing this wrongly. I do want to help, but I’m not a mind reader.

1 Like

@wreed oh yeah, So now I directly running the server from eclipse and gets below error which looks similar to the earlier one. Attaching screenshot for reference.

Can you share the capabilities? According to the screenshot they are blank.

@wreed Yes sure. below capabilities are used in my eclipse program:

DesiredCapabilities cap = new DesiredCapabilities();

	cap.setCapability("deviceName", "Realme C21");
	cap.setCapability("udid", "TS5HAEEMDYAUVKRS");
	cap.setCapability("platformName", "Android");
	cap.setCapability("platformVersion", "11.0");
	cap.setCapability("appPackage", "com.loyaltyhub");
	cap.setCapability("appActivity", "com.loyaltyhub.MainActivity");

No route usually means that server url wasn’t set or is unreachable. Possibly something like this:

https://stackoverflow.com/questions/67458824/testing-mobile-app-with-appium-webdriverio-no-route-found-for-session

1 Like

@wreed It dint helped me. Like I changed the path in cmd also but still I gets the same error

Yeah, I suspect that there is some problem with all the different versions you have installed. At this point, my best advice to you is to uninstall what you have and follow a tutorial like this one:

https://appium.io/docs/en/about-appium/getting-started/index.html

Follow the tutorial closely and then when you get an error post it with the exact steps that have gotten you to the error. Reference the tutorial so that people know exactly what you are doing. Post a full log (not screenshots) using a gist: https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists

I’m going to be offline for a couple of days. Will check in when I get back. With the tutorial you should have plenty to do in meantime.

1 Like

Sure @wreed, Thank you so much for your guidance. Sorry If I troubled you

No trouble. Camping with the family = no internet. It’s good to unplug for a couple of days.

I hope that things are going well with the tutorial.

1 Like