Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

440
Visualizações
Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: element not interactable

I have the following code :

import java.util.HashMap; import java.util.Map;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;

public class LoginToThePortal {
     public static void main(String[] args) throws InterruptedException
     {
    
    
         System.setProperty("webdriver.chrome.driver","C:\\chromedriver\\chromedriver.exe");
         WebDriver driver=new ChromeDriver();
         driver.manage().window();
         driver.get("");
         Thread.sleep(2000);
         WebElement username=driver.findElement(By.id("sfdc_username_container"));
         Thread.sleep(5000);
         WebElement password=driver.findElement(By.id("sfdc_password_container"));
         WebElement login=driver.findElement(By.xpath("//*[@id=\"centerPanel\"]/div/div[2]/div/div[2]/div/div[3]/button/span"));
         username.sendKeys("");
         password.sendKeys("");
    
          login.click();
         
        
    }
    }

And I have received the following error:

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

And I don't understand how I have wrong. I will mention that I am at the begin. (I m still learning). Can someone have a look?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Can you try with the below updated xpath's, Hope this will resolve your issue

  System.setProperty("webdriver.chrome.driver","C:\\chromedriver\\chromedriver.exe");
    WebDriver driver=new ChromeDriver();
    driver.manage().window();
    driver.get("https://qa-advisor.cs105.force.com/s/login/");
    Thread.sleep(2000);
    WebElement username = driver.findElement(By.xpath
           ("//div[@id='sfdc_username_container']//child::div/input[1]"));
    Thread.sleep(5000);
    WebElement password = driver.findElement(By.xpath
           ("//div[@id='sfdc_password_container']//child::div/input[1]"));
    WebElement login = driver.findElement(By.xpath
           ("//button[@class='slds-button slds-button--brand loginButton uiButton- 
                         -none uiButton']//child::span"));
    username.sendKeys("test");
    password.sendKeys("test");
    login.click();

enter image description here

over 4 years ago · Santiago Trujillo Relatório

0

To send a character sequence to the Username and Password field you need to use WebDriverWait for the elementToBeClickable() and you can use the following css-selectors based Locator Strategies:

driver.get("https://qa-advisor.cs105.force.com/s/login/");
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("div#sfdc_username_container input[placeholder='Username']"))).sendKeys("Test");
driver.findElement(By.cssSelector("div#sfdc_password_container input[placeholder='Password']")).sendKeys("Test");

Browser Snapshot:

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda