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

175
Views
Execute a selenium script in javascript on button click

I am using I wrote a small selenium script in javascript that executes find with node (filename.js) in the terminal but when I try to execute that script with a button click it doesnt work.

I took the guts out and put an alert() and it executed.

Just wondering if anyone can spot what I am doing wrong here?

Here is the script

async function example() {

const {Builder, By, Key, util} = require("selenium-webdriver");
require("chromedriver");
let driver = await new Builder().forBrowser("chrome").build();

await driver.get("http://google.com");
await driver.findElement(By.name("q")).sendKeys("Selenium Test", Key.RETURN);

}

And here is the php file I want to execute it from

    <!doctype html>
<html lang="en">
<head>
    <title>Sidebar 01</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <script src="index.js"></script>

</head>
<body>

<center>
    <button onclick="example();">Hello</button>
</center>

</body>
</html>
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!