Import org openqa selenium webdriver ошибка

Asked
4 years, 3 months ago

Viewed
18k times

I’m new to selenium webdriver and java programming. Trying to resolve the error in eclipse 2018-12 «The import org.openqa.selenium.WebDriver cannot be resolved» Im using java 11, selenium standalone server 3.141.59 . Kindly help. I’m unable to import jar files Below is the screenshot

enter image description here

enter image description here

undetected Selenium's user avatar

asked Feb 26, 2019 at 0:51

reyrro's user avatar

2

As per Can’t compile Java9 module with selenium-java as dependency it seems the Selenium packages can’t be compiled with Java 9 due to split packages and till May 15, 2018 Selenium wasn’t fully compatible with Java 9.

But as per this comment @Jarob22 mentioned, Selenium works just fine using Java 10. Java 9 is already eol and there’s not much point adding extra stuff to try and support just it if 10 works.

But with the landing of e57914a Simon introduced us with basic JPMS support. With this availability (mhomnag/selenium-java10-reproducer@bc63889) now actually builds but you may have to Remove the WebDriverWaiter and just use a sleep for now.


Java 11

As you are using java.version: ‘11.0.1’, selenium-server-standalone-3.141.59.jar is still not compatible with Java 11. But once Java 11 ships and Buck supports it the toolchain witll be rejiged to support Java 11.


Solution

The strategic solution will be to install the latest version of JDK 8u212 and execute the @Tests

answered Feb 26, 2019 at 7:18

undetected Selenium's user avatar

3

Chromedriver is located at the same place as this file.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public WebDriver getDriver(final String browser) {
        System.setProperty("webdriver.chrome.driver", "chromedriver");
        WebDriver driver = null;
        driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS);
        return driver;
    }

error: package import org.openqa.selenium.WebDriver does not exist

error: package org.openqa.selenium.chrome.ChromeDriver
does not exist

I have refered to the link but failed to resolve it

Here is pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.selenium.demo</groupId>
    <artifactId>SeleniumMavenDemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.0</version>
        </dependency>               
    </dependencies>
    <build>
        <plugins>
            <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                  </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

automated-testing.info

Загрузка…

  • testomat.io управление авто тестами
  • Python
  • Реклама
  • Работа
  • Консультации
  • Обучение

Get the Reddit app

Scan this QR code to download the app now

Or check it out in the app stores

As per Can’t compile Java9 module with selenium-java as dependency it seems the Selenium packages can’t be compiled with Java 9 due to split packages and till May 15, 2018 Selenium wasn’t fully compatible with Java 9.

But as per this comment @Jarob22 mentioned, Selenium works just fine using Java 10. Java 9 is already eol and there’s not much point adding extra stuff to try and support just it if 10 works.

But with the landing of e57914a Simon introduced us with basic JPMS support. With this availability (mhomnag/[email protected]) now actually builds but you may have to Remove the WebDriverWaiter and just use a sleep for now.


Java 11

As you are using java.version: ‘11.0.1’, selenium-server-standalone-3.141.59.jar is still not compatible with Java 11. But once Java 11 ships and Buck supports it the toolchain witll be rejiged to support Java 11.


Solution

The strategic solution will be to install the latest version of JDK 8u212 and execute the @Tests

Понравилась статья? Поделить с друзьями:
  • Immergas ошибка е10 как исправить
  • Immergas ошибка 10 мигает что делать
  • Immergas eolo star ошибка 01 что делать
  • Immergas eolo star коды ошибок
  • Immergas eolo mythos ошибка е11