Facing object related issues when executed from Tomcat Server

Hi,

I have my test code hosted in Tomcat Server. If i try to do some testing from Tomcat Server I am getting the below error

java.lang.NullPointerException
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:275)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:82)
at com.bt.e2etestframework.modules.MyJobsManager.fn_launchCalculator(MyJobsManager.java:68)

This error occurs when i do any of the below options(may be more other actions)

webelement.click()
webelement.sendkeys()
webelement.isDisplayed()

Appium Studio - v11.2.23
iPhone 5S - OS - 10
Tomcat Server - 8.0

I’m not sure that I fully understand your setup

your code is driven from the Tomcat server and connects to a remote Appium Studio station?

in any case, can you shed some details on line 68 in your code? what does it attempts to do?

Tom,

Question 1:

Yes I have the code driven from Tomcat Server. I am using below code to establish the connection with the device in Appium Studio
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(“reportDirectory”, “report_Path”);
dc.setCapability(“reportFormat”, “html”);
dc.setCapability(“testName”, “testCaseName”);
dc.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhoneName”);
dc.setJavascriptEnabled(true);

		driver = new IOSDriver(new URL("http://localhost:4723/wd/hub"), dc);

Question 2:

Below is the complete code of the method in Line 68:

public void fn_launchCalculator() {
	try {
		calculator = driver.findElement(By.xpath("//*[@text='Calculator']"));
		calculator.click();
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}

I have an observation with respect to Calculator element identification
calculator = driver.findElement(By.xpath("//*[@text=‘Calculator’]"));

Incase of execution from tomcat server, For the above element the properties are as attached in screenshot(Parent is NULL)

Incase of execution from local TestNG project, For the above element the properties are as attached in screenshot(Parent refer to IOSDriver instance)

But i am not able to infer any solution from the above observations.

hmm, the calculator type is different in both cases (IOSElement vs RemoteWebElement)
can you share with us the line where you declare the element? (e.g WebElement calculator; )

Can you try forcing type of calculator?

e.g

IOSElement calculator;

Tom,

I have got the issue resolved. It was the problem with the maven dependency which i haven’t added to the Project in Tomcat Server

It is mandatory to have below clients in order to utilize Appium Studio anywhere

  1. Java Client
  2. Selenium Server Standalone

Thanks & Regards
Thulasiram

Great thanks for sharing your feedback