Selenium的新手-无法访问RemoteWebDriver错误 [英] New to Selenium - cannot access RemoteWebDriver error

查看:874
本文介绍了Selenium的新手-无法访问RemoteWebDriver错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Selenium的新手,我尝试使用IntelliJ和Selenium 2设置我的第一个Selenium测试.我已经按照Selenium官方网站上的教程进行操作,但是却遇到此错误:

cannot access org.openqa.selenium.remote.RemoteWebDriver
    class file for org.openqa.selenium.remote.RemoteWebDriver not found

这是我正在使用的教程- http://seleniumhq.org/docs/03_webdriver.html#chapter03-参考

这是我遵循的Maven设置的位置- http ://seleniumhq.org/docs/appendix_installing_java_driver_Sel20_via_maven.html#importing-maven-into-intellij-reference

这是代码:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class MyAppHomePageTest {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
    } 
}

当我尝试创建FirefoxDriver实例时发生错误.我是否需要Selenium服务器,因为我认为这不再需要.

我在Eclipse中尝试过相同的操作,并收到了相同的错误.

谢谢

解决方案

您应该使用此Maven依赖项:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.1.0</version>
</dependency> 

根据此图片,您不需要selenium-server依赖项:

源: http://seleniumhq.org/download/maven.html

I'm new to Selenium and I have tried to setup my first Selenium test using IntelliJ and Selenium 2. I have followed the tutorials on the official Selenium site but I get this error:

cannot access org.openqa.selenium.remote.RemoteWebDriver
    class file for org.openqa.selenium.remote.RemoteWebDriver not found

This is the tutorial I am using - http://seleniumhq.org/docs/03_webdriver.html#chapter03-reference

This is the location for the Maven setup I followed - http://seleniumhq.org/docs/appendix_installing_java_driver_Sel20_via_maven.html#importing-maven-into-intellij-reference

Here is the code:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class MyAppHomePageTest {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
    } 
}

The error occurs when I try to create a FirefoxDriver instance. Do I need to have the Selenium server as I thought this is no longer required.

I have tried the same in Eclipse and received the same error.

Thank you

解决方案

You should use this Maven dependency :

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.1.0</version>
</dependency> 

According to this picture, you don't need a selenium-server dependency:

source : http://seleniumhq.org/download/maven.html

这篇关于Selenium的新手-无法访问RemoteWebDriver错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆