-
- Notifications
You must be signed in to change notification settings - Fork 768
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I am trying to find the Search Box in the iOS Settings app. This is my locator:
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeSearchField[$name ==[C] 'Search'$]")
private WebElement weSearchText;
The same is working fine with AppiumBy variable.
This is my appium instantiation from log:
When I execute that line, I got this in log:
As you can see, it seems that the logs are sending my element name as iosClassChain instead of my locator:
{"using":"class chain","value":"**/*[
name == "weSearchTextBox"]"}
What am I doing wrong here?
I tried @findby similarly for Xpath and that worked fine.
Expected Behavior
The element should ideally get identified properly.
Minimal Reproducible Example
package com.tekioncloud.core.main.mobile.pages; import io.appium.java_client.AppiumBy; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.PageFactory; import java.net.MalformedURLException; import java.net.URL; public class MobileSettingsAppTest { @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeCell[`label ==[C] 'General'`]") private WebElement weGeneral; private By byGeneral = AppiumBy.iOSClassChain("**/XCUIElementTypeCell[`label ==[C] 'General'`]"); public static void main(String[] args) { try { DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability("platformName", "iOS"); desiredCapabilities.setCapability("appium:automationName", "XCUITest"); desiredCapabilities.setCapability("appium:bundleId", "com.apple.Preferences"); desiredCapabilities.setCapability("appium:deviceName", "iPhone XR"); desiredCapabilities.setCapability("appium:newCommandTimeout", "0"); desiredCapabilities.setCapability("appium:platformVersion", "12.1"); desiredCapabilities.setCapability("appium:udid", "00008020-001B044C0193802E"); desiredCapabilities.setCapability("appium:waitForQuiescence", false); desiredCapabilities.setCapability("appium:wdaLocalPort", "8100"); IOSDriver iDriver = new IOSDriver(new URL("http://0.0.0.0:4723"), desiredCapabilities); iDriver.setSetting("useFirstMatch", true); MobileSettingsAppTest mobileSettingsAppTest = new MobileSettingsAppTest(); PageFactory.initElements(iDriver,mobileSettingsAppTest); mobileSettingsAppTest.weGeneral.click(); // iDriver.findElement(mobileSettingsAppTest.byGeneral).click(); } catch (MalformedURLException e) { throw new RuntimeException(e); } } }
Environment
- Operating system:
- If running via
appium
CLI...- Appium CLI version (output of
appium --version
): 2.0.0-beta.44 - Node.js version (output of
node --version
): v18.7.0 npm
version (output ofnpm --version
): 8.18.0- Last
appium
version which did not exhibit the problem: Didn't try this previously
- Appium CLI version (output of
- If running Appium Desktop, its version: NA
- Appium driver(s) and their version(s): xcuitest@4.11.1
- Appium plugin(s) and their version(s): NA
- Platform and version under test: iOS 16.1.1
- Real device or emulator/simulator: iPhone XR real device
Link to Appium Logs
No response
Futher Information
No response