I have been experimenting with a simple method using Selenium and JavaScript. My goal is to execute this method when I invoke a basic web service created with Express. Here is the Selenium method:
async function example()
{
try{
let driver = await new Builder().forBrowser("firefox").build();
await driver.get("https://accounts****.com/login")
await driver.manage().window().setRect(814, 705)
await driver.findElement(By.name("email")).sendKeys("*******")
await driver.findElement(By.name("password")).sendKeys("*****", Key.RETURN)firefox
}catch(error){
console.log(">>>error: "+error)
}
}
I attempted to use this web service, but unfortunately it did not work for me:
server.get('/login', (req, res) => {
res.send(example())
})
Therefore, my aim is to trigger the Selenium method when I access this web service at http://localhost:3000/login. Any assistance in achieving this would be greatly appreciated!