0

I am trying to bind a value to an input element using Selenium Java, but I keep getting error

ElementNotInteractableException: Element is not reachable by keyboard

I have tried the solution suggested in this Stack Overflow post: org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard: while sending text to FirstName field in Facebook, but I am still encountering the same error.

Can anyone please suggest any other solutions or potential causes for this error?

WebElement emailAddyField = driver.findElement(By.id("email"));
emailAddyField.sendKeys(username);

--

<div class="field-two-input-wrapper flex flex-nowrap flex-align-items-stretch flex-item-fluid relative">
    <div class="flex flex-item-fluid">
        <input autocomplete="off" autocapitalize="none" autocorrect="off" spellcheck="false" aria-invalid="false"
               id="email" aria-describedby="id-2" class="field-two-input w100 email-input-field" value="">
    </div>
    <div class="field-two-input-adornment mr0-5 flex flex-align-items-center flex-item-noshrink flex-nowrap flex-gap-0-5">
        <button type="button" aria-expanded="false" aria-live="assertive" aria-atomic="true" aria-invalid="false"
                class="outline-none w100 flex flex-justify-space-between flex-align-items-center flex-nowrap no-pointer-events-children"
                aria-label="proton.me" id="select-domain">
            <span class="flex-item-fluid text-ellipsis text-left">@proton.me</span>
            <svg viewBox="0 0 16 16" class="icon-16p flex-item-noshrink ml0-5" role="img" focusable="false"
                 aria-hidden="true">
                <use xlink:href="#ic-chevron-down-filled"></use>
            </svg>
        </button>
    </div>
</div>

Thank you.

James Z
  • 12,209
  • 10
  • 24
  • 44
simyaci
  • 53
  • 6

1 Answers1

0

Found a solution finally. I didnt notice at the begining but the <div> was inside of an iframe. The code below solved the problem.

driver.switchTo().frame("frameName");
WebElement emailAddyField = driver.findElement(By.id("email"));
emailAddyField.sendKeys(username);
driver.switchTo().defaultContent();
simyaci
  • 53
  • 6