Can only find elements by xpath iOS

Can somebody help me locate Elements other than xpath? I tried many different methods all day long, none of them seem to work, unless I am doing something wrong.

I tried using WebElements and using by name ect.

I also tried MobileElements by.name and that didn’t work either.

The element in the iOS app has a name that is Sign In

This is my pageObject page:

public PageObject(AppiumDriver<MobileElement> driver) {
		PageFactory.initElements(new AppiumFieldDecorator(driver), this);
	}
 
	@iOSFindBy(name = "Sign In")
	public  MobileElement SignIn;
 
}

This is another version of my current xpath page Objects which I need to make TouchActions work.

public class welcomeWheelsUP {
	AppiumDriver<MobileElement> driver;
	
	public welcomeWheelsUP (AppiumDriver<MobileElement> driver) {
		this.driver=driver;
		
	
	}
	
// By 
public By SignInBTN = By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]");
public By RequestAccountBTN = By.name("Request an account");
public By DiscoverBTN = By.name("Discover");

// Mobile Elements
public MobileElement SignInMOB() {
	return (MobileElement) driver.findElement(SignInBTN);
}

public MobileElement RequestAccountMOB() {
	return (MobileElement) driver.findElement(RequestAccountBTN);
}

public MobileElement DiscoverMOB() {
	return (MobileElement) driver.findElement(DiscoverBTN);
}

	

// Web Elements
public WebElement SignInWEB() {
	return driver.findElement(SignInBTN);
}

public WebElement RequestAccountWEB() {
	return driver.findElement(RequestAccountBTN);
}

public WebElement DiscoverWEB() {
	return driver.findElement(DiscoverBTN);
}

So my question is:

How can I use different locator strategies and still be able to use TouchActions?

Thanks

Fixed issue it was a case sensitive issue

1 Like