My Xpath is correct & no iFrame and I can locate element in Chrome console but my program still fails. I have used explicit wait also.
no such element: Unable to locate element: {"method":"xpath","selector":"//*[contains(@ng-click,'authenticationCtrl.onSubmitMage()')]"}
i tested my xpath with Try xpath and it works but when i compile my code i still recieve the error
the page Object :
package com.orange.pageObject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class MageReferentiel {
WebDriver webdriver;
public MageReferentiel(WebDriver rwebDriver) {
webdriver = rwebDriver;
PageFactory.initElements(webdriver, this);
}
@FindBy(xpath = "//*[contains(@ng-click,'authenticationCtrl.onSubmitMage()')]")
@CacheLookup
WebElement connexion;
public void clickConnexion() {
connexion.click();
}
The step definition :
@When("l utilisateur choisi le referentiel")
public void l_utilisateur_choisi_le_referentiel() throws Exception {
mr.clickConnexion();
Thread.sleep(3000);
}
im looking to click in button
thanks
I agree with @Prophet, it could be because of some JS call the button, //*[contains(@ng-click,'authenticationCtrl.onSubmitMage()')]
changing it's state to some other state. so what we can do about is that, to try with different locator.
such as :
//button[@translate ='LOGIN']
and see if that works, even if it doesn't try changing it to css.