Left Handed
Left Handed

Reputation: 1

@AndroidFindBy not working when i used appiumDriver

I want to use AndroidAndroidFindBy and iOSXCUITAndroidFindBy, but not working.

error code:

org.openqa.selenium.InvalidSelectorException: Unsupported CSS selector '*[name='introStartButton']'. Reason: 'Error: 'name' is not a valid attribute. Supported attributes are 'checkable, checked, clickable, enabled, focusable, focused, long-clickable, scrollable, selected, index, instance, description, resource-id, text, class-name, package-name''

my code is here:

package commonSteps.Auth;


import Helpers.Config; 
import Helpers.Utils;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.qameta.allure.Step;
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.support.PageFactory;
import org.testng.annotations.Test;

import java.util.Objects;

public class simpleClass {
 
    //locators
    @iOSXCUITAndroidFindBy(accessibility = "button_login")
    @AndroidFindBy(id = "introStartButton")
    WebElement loginLocator;

 

    // Creating a variable called driver that is of type WebDriver.
    public AppiumDriver driver;
 

    // This is a constructor. It is called when an object of the class is created.
    public simpleClass(AppiumDriver driver) {
        this.driver = driver;
        PageFactory.initElements(driver, this);
  
 }


 
    @Test(description = "example")
    public void simpleTest() throws InterruptedException {
    loginLocator.click();
   }
 

}

Upvotes: 0

Views: 391

Answers (1)

monil
monil

Reputation: 77

Error message you have shared state that you were trying to use css selector name. But name is not a valid css selector. Valid Css selectros are class and id. In code the code snippet you mentioned id=introStartButton Can you please share complete code which I try to execute on my local machine?

Upvotes: 0

Related Questions