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

149
Views
Valores aleatorios en selenio

Soy nuevo en Selenium y no puedo entender cómo insertar valores aleatorios en un Send.Key en un findElement . Estoy usando el controlador web Selenium con Java.

Aquí está mi código:

 driver.findElement(By.id("id1")).click(); { int T; double M=0; boolean S = true; boolean x = false; double p = 1; for (T = 0; T == (int) Math.floor(T / 10);) p = (p + T % 10 * (9 - M++ % 6)) % 11; //return S?S-1:'k'; alert(x ? p - 1 : 'k'); double alert; driver.findElement(By.id("id1")).sendKeys(alert); }

¿Alguien podría decirme cómo hacer esto?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

driver.findElement(By.id("id1")).click(); String Capital_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String Small_chars = "abcdefghijklmnopqrstuvwxyz"; String numbers = "0123456789"; int length = 8; // You can change the lenght of the random string as per your requirement String values = Capital_chars + Small_chars + numbers ; Random randomGenerator = new Random(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < length; i++) { // generate random index number int index = randomGenerator.nextInt(values.length()); // get character specified by index // from the string char randomChar = values.charAt(index); // append the character to string builder sb.append(randomChar); } System.out.println("sb===="+sb.toString()); driver.findElement(By.id("id1")).sendKeys(sb.toString());
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!