Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

178
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda