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

199
Views
Cómo convertir datos de tabla en matriz usando selenio + Javascript

Quiero obtener datos de la tabla HTML para cubrir la matriz mediante el uso de selenio y Javascript. Pruebo el siguiente código y puedo obtener console.log (lm) en el bucle for, pero muestra una matriz en cada bucle.

la página web es https://www.scoresandodds.com/mlb y haga clic en Detalles del juego-->Movimiento de línea

¿Cómo puedo obtener una matriz (lm) al final del código? ¿Por qué no puedo obtener ningún dato en mi código?

 console.log("Line Movement=================================\n"); driver.findElement(By.xpath('//*[@id="line-movements-tab--65040"]/span')).click(); //Line Movement await driver.sleep(2500); let rowC = ''; driver.findElements(By.xpath('//*[@id="line-movements--65040"]/div/table/tbody/tr')).then( function(rows){ console.log("[" + rows.length + "]" + "\n\n"); rowC = rows.length; }); var lm=[]; for (i=0; i<rowC; i++) { for (s=1; s<5; s++) { var addCellText=function(elem, doneCallback){ elem.getText().then(function(textValue){ driver.sleep(1000); lm.push(textValue); return doneCallback(null); }); }; xpath='//*[@id="line-movements--65040"]/div/table/tbody/tr[' + i + ']/td[' + s + ']'; driver.findElements(By.xpath(xpath)).then(function(elem){ async.each(elem, addCellText, function(error){ driver.sleep(1000); //console.log(lm); }); }); } } console.log("lm"); console.log(lm);

cada equipo tiene un código diferente, como 65040, mire el código de cada juego en el html. Por ejemplo, hoy (30/5) ARI-ATL del código es 65051.

about 4 years ago · Juan Pablo Isaza
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!