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

178
Views
While doing selenium, how to do enter key action, on a search bar which has no search button

I've been trying to test an ecommerce site after I close the initial popup no elements is captured by

bd.findElement(By.xpath("/html/body/div[5]/div[2]/div[1]/div[4]/div[3]/div/span")).click();

So, I have been using

JavascriptExecutor js = (JavascriptExecutor)bd;
js.executeScript("arguments[0].click();", element);

And after a while I got stuck at a place where I have to do the enter key action. I have been trying various keys for this and none of them seems to work. So, I either need a code for using the enter button event on the search bar using JavascriptExecutor or a solution where I can fetch elements using findElement.

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

0

To enter the text within the search field you can use the following solution:

js.executeScript("arguments[0].value = 'valueToEnter';", webelement);
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!