1

I have below page and I need to click on User Login.

I am unable to locate an element to proceed with.

<a class="nav-link page-scroll login-a ng-binding" data-toggle="modal" data-target="#loginToast" href="javascript:void(0);" ng-click="vm.showLoginToast({},'login');" ng-class="{'urdu-login-mobile':language==='UR' || language==='ur'}">User Login</a>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Priya
  • 13
  • 5

1 Answers1

1

The element is Angular element so to click() on the element you have to induce WebDriverWait for the element to be clickable and you can use either of the following Locator Strategies:

  • Using Java and cssSelector:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.page-scroll.login-a.ng-binding[data-toggle='modal'][data-target$='loginToast']"))).click();
    
  • Using Python and XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@class='nav-link page-scroll login-a ng-binding' and @data-toggle='modal'][text()='User Login']"))).click()
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • @ShipraSaxena As per StackOverflow best practices you need to raise a new question with your new requirement, Stackoverflow contributors will be happy to help you out and you can choose the best answer among several which caters to your need. – undetected Selenium Dec 17 '19 at 09:10