Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

432
Views
Excepción en el subproceso "principal" org.openqa.selenium.ElementNotInteractableException: elemento no interactuable

Tengo el siguiente código :

importar java.util.HashMap; importar 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(); } }

Y he recibido el siguiente error:

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

Y no entiendo cómo me equivoqué. Mencionaré que estoy al principio. (Todavía estoy aprendiendo). ¿Puede alguien echar un vistazo?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

¿Puedes probar con los xpath actualizados a continuación? Espero que esto resuelva tu problema.

 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();

ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo Report

0

Para enviar una secuencia de caracteres al campo Nombre de usuario y Contraseña , debe usar WebDriverWait para elementToBeClickable() y puede usar las siguientes estrategias de localización basadas en selectores css :

 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");

Instantánea del navegador:

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!