• Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Precios
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

102
Vistas
Xpath element not interractable issue. Selenium,Java

I have been trying to access a search bar and submit the query which doesnot have a SEARCH BUTTON, as I Could enter the search query using javascriptexecutor, I Couldnot do an enter button action as It doesnot have any enter button. so I have went with the following ways and none of them worked. Please consider and correct me.

I have tried to do an enter key action on the search bar. the code is as followed driver.findElement(By.xpath("//*[@id="mobile-header"]/div[3]/input").sendKeys(Keys.RETURN); and WebElement search = bd.findElement(By.xpath("//*[@id=\"mobile-header\"]/div[3]/input")); search.sendKeys(Keys.RETURN);

and `in the following code the value is passed but the enter key is not working JavascriptExecutor jj= (JavascriptExecutor)bd; jj.executeScript("arguments[0].value='mercury'", search); jj.executeScript("arguments[0].value=Keys.Return", search);

none of the seems to work. correct if i have my xpath wrong. thanks

9 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This should work:

    driver.findElement(By.xpath("//*[@class='st-search-box hidden-mobile-only']//input[@type='text']").sendKeys("headphones);
    ActionChains(driver).sendKeys(Keys.RETURN)

DOM snapshot

9 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.