How to pass parameter in page factory

@iOSXCUITFindBy(iOSNsPredicate = “value == “City””)

private IOSElement city;

here in above code instead of Value i need to pass from properties file how can i do that

Please help me
for Java code.

It will not work from file. It compiles with this value.

is there any other solutions to use dynamic locator which is changing frequently on iOS app

Switch to driver.findElement…

I am building my framework but I am unable to start my simulator with the code I wrote. when I put the code in a separate class outside my appiumproject. the code starts the simulator. But inside my configuration class, it does not work. Below is my complete code. kindly help review it. thanks. the code is
public static void startSimulator() throws IOException, InterruptedException
Runtime.getRuntime().exec(“xcrun simctl boot 446B22A4-870D-4BCF-A0FB-169C367762AE”);

Below is my complete config file

package MAYD.CustomerAppiOS;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;

import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.AutomationName;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;

public class ScriptDependency {

public static IOSDriver<IOSElement> driver;

public static AppiumDriverLocalService service;

public AppiumDriverLocalService startServer() {

	boolean flag = checkIfServerIsRunning(4723);
	if (!flag)


		AppiumServiceBuilder builder = new AppiumServiceBuilder()
				.withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"))
				.withLogFile(new File(System.getProperty("user.dir") + "/appiumServerLog.txt"));
		service =;
	return service;

public static boolean checkIfServerIsRunning(int port) {

	boolean isServerRunning = false;

	ServerSocket serverSocket;

	try {
		serverSocket = new ServerSocket(port);


	} catch (IOException e) {

		// If control comes here, then it means that the port is in use

		isServerRunning = true;

	} finally {

		serverSocket = null;

	return isServerRunning;

public static void startSimulator() throws IOException, InterruptedException 
		Runtime.getRuntime().exec("xcrun simctl boot 446B22A4-870D-4BCF-A0FB-169C367762AE");


public static IOSDriver<IOSElement> DesiredCapabilities() throws MalformedURLException {
	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "15.0");
	capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 12 Pro");
	capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
	capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
	capabilities.setCapability("commandTimeouts", "12000");
	driver = new IOSDriver<>(new URL("http://localhost:4723/wd/hub"), capabilities);

	driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

	return driver;

public void killAllNODES() throws IOException, InterruptedException {
	Runtime.getRuntime().exec("killall node");


public static void getScreenshot(String s) throws IOException {
	File scrfile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
			new File("/Users/emmanuel/eclipse-workspace/CustomerAppiOS/src/main/java/FailedScreenshot=" + s + ""));


if you start simulator manually - does the test work?

Yes, The test work if I start simulator manually,

did not use loooong time to start simulators from test code. used to work with real devices.
indeed when we start simulator using xcrun simctl boot xxx visually it does not start.
but! xcrun simctl list shows it state as BOOTED.
it looks like need:
exec open to launch the foreground GUI ->

I have also tried it. it does not launch the foreground GUI. Its okay, thank you for your time.