I have created a simple selenium app and now I want it to launch from a gui.
Here is my code
index.html:
<html>
<head>
<meta charset="UTF-8" />
<title>App</title>
<link rel="stylesheet" href="index.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
<script defer src="selenium.js"></script>
</head>
<body>
<div class="align">
<h1>App</h1>
<button id="start" class="button is-primary">Start</button>
</div>
</body>
</html>
selenium.js:
startButton.onclick = selenium;
const {Builder, Browser, By, Key, until} = require('selenium-webdriver');
async function selenium() {
let driver = await new Builder().forBrowser("chrome").build();
await driver.get('https://google.com');
await driver.findElement(By.id("L2AGLb")).click()
await driver.findElement(By.xpath("/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input")).sendKeys("selenium",Key.RETURN);
}
I keep on getting
Uncaught ReferenceError: require is not defined
What should I be doing differently?