0

The Element is inside tag but many ways tried couldn't click on it.

wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Login to Register']"))).click();

and

WebElement element = driver.findElement(By.xpath("//input[@value='Login to Register']"));
JavascriptExecutor jsEx= (JavascriptExecutor)driver;
jsEx.executeScript("arguments[0].click();", element);

Here is the html:

<div id="requestRegistrationWidget">
     <a id="requestLocationLogin" href="/user/login?destination=%2Fsearch%2Flocations%2Fwidget%3Fparam1%3D006046-0619_1565278200_11000000%26param2%3D3" class="use-ajax login-popup-form" data-dialog-type="modal">
        <input class="btn btn-primary" style="width: 100% !important;" type="button" value="Login to Register"></input>
    </a>
      <!-- registerSession == 3 and registerAnyActiveSession == 1 case (2) --> 
</div>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Sayem
  • 1
  • 2
  • Can you share the url? – EylM Aug 06 '19 at 18:40
  • https://preview.queenslibrary.org/search/calendar?searchField=*&category=calendar&searchFilter= Just click any card you'll see Quick View the right side an specific section is not workable. Thanks. – Sayem Aug 06 '19 at 18:51
  • https://preview.queenslibrary.org/search/calendar?searchField=*&category=calendar&searchFilter= " click on search put star click ''Calendar" Radio Button and click search from the right side Just click any card you'll see Quick View the right side an specific section is not workable. Thanks. – Sayem Aug 06 '19 at 18:56
  • I can't reproduce with your steps above, but it's possible your selector isn't selecting what you think it is and that's why it's not clickable. – DMart Aug 06 '19 at 19:25
  • Navigation --> click Search from the top right after 'Donate' Button than put * on ' keyword' and select 'Calendar' Radio Button than click on Search Button from the right. After that click on any of cards you'll see in Quick View pane at right side of the card this specific portion I can't click.- Thanks. @DMart – Sayem Aug 06 '19 at 19:39

3 Answers3

0

Can you give a try with the below code.

WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(By.id("requestLocationLogin"))).click();
Appu Mistri
  • 768
  • 8
  • 26
  • Select audience org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@value='Login to Register']"} (Session info: chrome=75.0.3770.142) For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' – Sayem Aug 06 '19 at 18:50
  • no such element: Unable to locate element: {"method":"xpath","selector":"//input[@value='Login to Register']"} – Sayem Aug 06 '19 at 19:53
0

I suppose you are facing this issue on chrome. Try this, it works for me.

element.sendKeys(Keys.RETURN);

Its just hitting the "Enter" button on the element.

nvntkmr
  • 96
  • 3
0

To click() on the element with text as Login to Register as the element is AJAX enabled element you have to induce WebDriverWait for the elementToBeClickable() and you can use either of the following Locator Strategies:

  • cssSelector:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("a.use-ajax.login-popup-form#requestLocationLogin>input.btn.btn-primary[value='Login to Register']"))).click();
    
  • xpath:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@class='use-ajax login-popup-form' and @id='requestLocationLogin']/input[@class='btn btn-primary' and @value='Login to Register']"))).click();
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352