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

339
Views
cómo seleccionar seleccionar en un formulario usando selenio en javascript

Estoy automatizando algunas pruebas de un proceso que contiene un formulario donde puedo obtener todos los pasos, pero cuando llego a la selección, no puedo hacer que se automatice para que él haga clic y elija la opción que quiero en javascript.

mi código;

 const {Builder, By, Key} = require("selenium-webdriver"); async function example() { // launch the browser let driver = await new Builder().forBrowser("chrome").build(); // navigate to our application await driver.get("https://dev.septemcompliance.com/designer/design.aspx? c=0asrnQyA%2bharoubJy0g6zqq%2fVssaPaDM6m0yv7hD0hTwY8bXo%2bNQLRsUzDolSOAT") // add a todo await driver.findElement(By.id("TxtLogin")).sendKeys("joao") await driver.findElement(By.id("TxtPassword")).sendKeys("010445jv") await driver.findElement(By.id("BtnLogin")).click() await driver.findElement(By.id("HlOpenSimulation")).click() await driver.findElement(By.id("HlStartSimulation")).click() await driver.findElement(By.name("inp12082")).click(); await driver.findElement(By.xpath("//* [@id=td1secretaria_municipal]/select/option[1]")).click(); } example()

En la inspección del código seleccionado que quiero automatizar, este es el código en el sitio web.

 <select label="Secretaria municipal" name="inp12082" xname="inpsecretaria_municipal" xtype="SELECT" required="S" style="width:350px" onchange="controlValueChange(this);salvarSecretaria($(this));atualizarSecretariasExecutivas();" data-c="DSe28HiL3BwUi7ITIAiFKoPYC2jIQnf-1ElLrN9eVsFFzP- O91XnU@emdmWvie5Aqx3Arj6ROWUKqAGZrCQsDjwO5geI9nuTiU9JlTlMz2hbH5D3M1D-E5loLjoTSRcU"> <option value="">Selecione</option><option value="1">SECRETARIA 1</option> </select>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si entendí el problema correctamente, solo necesita un selector CSS simple y luego use el método de clic.

 <select> <option value="1" selected="selected">one</option> <option value="2">two</option> </select>
 const element = await driver.findElement(By.css('select option[value="2"]')); await element.click();
about 4 years ago · Juan Pablo Isaza 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!