Encountered an error in the main thread: org.openqa.selenium.ElementNotInteractableException. The element is not interactable while using Selenium with Java and Edge WebDriver

Testing out some code:

import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Mftadminui {

    public static void main(String[] args) {`
        System.setProperty("webdriver.edge.driver", "C:\\Users\\shantha_mh\\Desktop\\SeleniumAutomation\\msedgedriver.exe");
        WebDriver driver = new EdgeDriver();
        driver.get("https://test.idp.idm.cms.gov/");
        driver.findElement(By.id("okta-signin-username")).sendKeys("HNAJ");
        driver.findElement(By.name("password")).sendKeys("Hs229988");
        driver.findElement(By.cssSelector("input[id='tandc']")).click();
        System.out.println(driver.findElement(By.cssSelector("input[id='tandc']")).isSelected());
        driver.findElement(By.className("button-primary")).click();
        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
        wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[@class='o-form-input-name-answer o-form-control okta-form-input-field input-fix']")));
        WebElement mfaInput = driver.findElement(By.xpath("//span[@class='o-form-input-name-answer o-form-control okta-form-input-field input-fix']"));
        String userInput = mfaInput.getAttribute("value");
        driver.findElement(By.xpath("//span[@class='o-form-input-name-answer o-form-control okta-form-input-field input-fix']")).click();
        mfaInput.sendKeys(" ");
        driver.findElement(By.id("input76")).click();

Attempting to automate the MFA User input, encountering an issue at the MFA input page with the error message below:

Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: element not interactable.

Trying to troubleshoot based on previous discussions, but unable to identify the problem in this code. Seeking assistance from the community.

Answer №1

It may not be entirely clear which step is causing you trouble. However, in order to input a sequence of characters into the <input> fields, you have the option to utilize any of the following Locator Strategies:

driver.get("https://www.example.com/");
new WebDriverWait(driver, Duration.ofSeconds(5)).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input#username"))).sendKeys("EXAMPLE123");
driver.findElement(By.cssSelector("input#password")).sendKeys("Password123");
driver.findElement(By.cssSelector("input[title='Agree to terms']")).click();
driver.findElement(By.cssSelector("input#submit-button")).click();

Browser Snapshot:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Jersey test framework using Grizzly reports a 404 error indicating resource not found

I am facing an issue with implementing JUnit tests for Jersey REST/Json in my application. Despite having the correct path, Grizzly returns a 404 not found error. However, when testing with Curl through the normal Webcontainer, everything works fine. My s ...

Opening links in new tabs individually using Selenium and Java from a menu

I am having some trouble opening multiple links in new tabs using Selenium Java. The first link opens successfully, but I'm running into issues when trying to open subsequent links within a loop. Can anyone provide guidance on how to resolve this issu ...

Tips for clearing Nightwatch session storage efficiently

To ensure the pop-up functionality was working properly, I had to reset the browser's session storage. By doing this, the pop-up will reappear. Is there a way to clear the page's Session Storage in Nightwatch? ...

Tips for sharing a single driver instance in the Page Object Model

My automation framework utilizes selenium, TestNG, and the PageObject model. In terms of structure: https://i.stack.imgur.com/xLPYB.png For my Testng class / test case: https://i.stack.imgur.com/WFM3p.png I encountered a null pointer error https://i.s ...

Tips on scraping content with no identifiable attributes in Selenium using Python

Looking to extract electricity prices data from the following website: . When trying to locate the web elements for the date and price, this is the structure: The first date: td class="row-name ng-binding ng-scope" ng-if="tableData.dataType ...

Selenium htmlUnit with dynamic content failing to render properly

My current project involves creating Selenium tests for a particular website. Essentially, when a user navigates to the site, a CMS injects some dynamic elements (HTML + JS) onto the page. Everything works fine when running tests on the Firefox driver. H ...

Navigating a webpage and interacting with elements within a different class using the Page Object Model (POM) in

I am currently working on a project with both a landing page and a registration page. While I have successfully stored the web elements from the landing page using @FindBy annotations, I now need to access these elements on the registration page. What st ...

Execute Firefox on a portable basis from a remote location

I am trying to use RemoteWebDriver to run Firefox in a portable mode, but I am encountering some issues: Below is the code that works perfectly for local execution: FirefoxProfile profile = new FirefoxProfile(); WebDriver driver = new FirefoxDriver( ...

Guide for clicking on a dynamic button with multiple words using cucumber and capybara

Struggling to write a test that involves clicking on a button with two separate words, as indicated in the code snippet below. The command Click_on("More Filters") is not effective because the button actually changes to "less Filters" when clicked due to ...

Having trouble with Selenium Chrome Webdriver in C#?

options.AddArgument("--disable-gpu"); driver = new ChromeDriver(options); driver.Navigate().GoToUrl(""); string currentDay = DateTime.Today.DayOfWeek.ToString(); ...

Jenkins is experiencing issues running Selenium scripts on Chrome and Firefox

My configuration includes the Selenium webdriver, along with TESTNG and Maven. I have successfully run tests on IE, Chrome, and Firefox from Eclipse. However, when I attempt to schedule these tests using Jenkins, they only work on IE and fail on Chrome an ...

Is NPM enterprise necessary for Angular2 and Java development?

Is an NPM enterprise version necessary if I plan to utilize Angular2 with Java as the backend technology for developing applications within my organization, without using Node JS or NPM server? ...

Guide to setting up a parameterized Selenium test using NUnit on TeamCity?

I am currently developing Selenium webdriver tests in Visual Studio with C# for regression testing. I have chosen NUnit as my testing framework. My goal is to parameterize the URL so that the same set of tests can be executed against various deployments u ...

Having trouble resolving issues with Selenium's Java WebDriver and ChromeDriver?

Hello! I'm encountering an error even after adding all the necessary jar files to the classpath. I have an interview coming up on Monday, so I really need to resolve this issue as soon as possible. My Java version is 21 and Chrome version is 122. Can ...

Ways to shut down an iframe using selenium

Currently tackling a Selenium webdriver Project where I find myself entering an iframe to input keys. However, now I am seeking guidance on how to exit that iframe in order to access a button outside of it. Here is a snippet of my code: WebDriverWait(bot,2 ...

Protractor - I am looking to optimize my IF ELSE statement for better dryness, if it is feasible

How can I optimize this code to follow the D.R.Y principle? If the id invite-user tag is visible in the user's profile, the user can request to play a game by clicking on it. Otherwise, a new random user will be selected until the id invite-user is di ...

Executing Scripts within the Browser: A Guide to Using Selenium

One of my current objectives involves running a script on my Selenium browser that establishes a variable and then using DevTools to access this variable in the console log. Below is the conflicting script that I am encountering issues with: from selenium ...

`Enhancing existing systems - extracting data from a JSON response`

i want to retrieve a JSON object from the following link: http://link/json and here is my JSON data: {"as":"AS48159 Telecommunication Infrastructure Company","city":"Ahvāz","country":"Iran","countryCode":"IR","isp":"Information Technology Company (ITC) ...

Finding specific text within an HTML tag using Selenium can be achieved by implementing certain techniques

Can someone help me extract the price of 234,40 € from the HTML code below using selenium? <a class="js-sku-link sku-link" title="Samsung Galaxy Watch4 Classic Bluetooth Stainless Steel 46mm Αδιάβροχο με Παλμογράφο (Black)" dat ...

The second JSP page fails to load following an AJAX POST request

The following code snippet is found in page1.jsp. $.ajax({ type: "post", url: "page2.jsp", data: newdata, success:function(msg){ return msg; } ...