1

I have started learning Selenium recently, but i am stuck on the first step itself, in-spite of adding all the required webdriver dependencies, while initiating the webdriver instance in a function, the webdriver interface is not shown and error is displayed. could anyone help me in this case. The dependencies added are shown under external files.

Thanks

  • 1
    What is the error shown? Could you show us your pom.xml? What does it mean when you say that dependencies added are shown under external files? – Aulis Ronkainen Jun 2 '18 at 21:00
1

From your description, I think you have missed setting up the browser's selenium driver. For this example I am using ChromeDriver 2.39.562718, found here: https://sites.google.com/a/chromium.org/chromedriver/

For reference, your POM.xml file could have these three dependencies below. But this is not enough. Your will need (for these dependencies) the 'chromedriver.exe' installed in OS path.

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>3.12.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>3.12.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>3.12.0</version>
    </dependency>

When you execute this code in your test function the OS will find the driver, and execute it setting up the Selenium server connection to the browser. Then the code will launch the Chrome browser, and navigate to the web page (BASE_URL).

    driver = new ChromeDriver();
    driver.get(BASE_URL);

This also assumes that you are using an updated Chrome browser. I am using Version 67.0.3396.62 (Official Build) (64-bit) with that version of Chrome driver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.