Dear Experts,
Can you identify the source of the error in this case?
Click works for:
iosDriver.findElement(AppiumBy.accessibilityId("Switches")).click();
But when @iOSXCUITFindBy
Annotations is used then it fails with org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
Below is the Click call made to Dashboard
screen
new Dashboard(iosDriver).clickOnSwitches();
Dashboard
screen class-
package com.example.pages.ios;
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.WebElement;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
import org.openqa.selenium.support.PageFactory;
public class Dashboard{
private IOSDriver driver;
public Dashboard(IOSDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
/**
* Locators
*/
@iOSXCUITFindBy(id = "Switches")
private WebElement switches;
public void clickOnSwitches() {
switches.click();
}
}