mardi 1 octobre 2019

opening test page in selenium

Starting to work with selenium, so I created (what I thought) was a quick test script to simply open a page within my company's intranet.

I wasn't sure where exactly I was supposed to download the dependencies for selenium, so I created a folder on my development server called "TESTING", and used the command prompt to install selenium:

 npm install selenium-webdriver

The install appears to be successful, as it reads "added 46 packages from 79 contributors..."

Inside my TESTING directory, I can see the node_modules directory was added, as well as the package-lock.json file.

I then created an index.php file that only has the following:

<h1>hello world</h1>
<button type="submit" name="btnI">Click Me</button>

Here is sample.js, which includes the following script that is supposed to open index.php:

var webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

driver.get("https://development.usa.company.com/testing/index.php");

driver.findElement(webdriver.By.name('btnI')).click();

I go back to the cmd prompt and run the following command:

node sample.js

And I get the following error:

Error: The ChromeDriver could not be found on the current PATH. 
Please download the latest version of the ChromeDriver from 
http://chromedriver.storage.googleapis.com/index.html 
and ensure it can be found on your PATH.

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire