I have created a Page Object in Java that is currently working for an Android app as shown below:
public class MattVerifyPage extends PageObject{
private AppiumDriver driver = FrameworkInitialize.driver;
By verifyTitle = By.xpath("/hierarchy/android.widget.TextView");
public void verifyTitle(String expectedTitle){
String actualTitle = driver.findElement(verifyTitle).getText();
However, I need it to work an the Android app and the iOS app, the xpath selector is different for both apps. I think I need to do something like this:
@AndroidFindBy(xpath = “androidxpath”)
@iOSFindBy(xpath = “iOSxpath”)
public MobileElement verifyTitle ;
However, when I do this, the driver.findElement line (String actualTitle = driver.findElement(verifyTitle).getText() shows the following error:
findElement
(org.openqa.selenium.By)
in DefaultGenericMobileDriver cannot be applied
to
(io.appium.java_client.MobileElement)
I think I am comparing AppiumElements with SeleniumElements but I’m not sure how to resolve it.
Any help would be greatly appreciated.
Thanks
Matt