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-reference
这是我遵循的 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 中尝试了相同的操作并收到了相同的错误。
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用此 Maven 依赖项:
根据这张图片,您不需要 selenium-server 依赖项:
来源:http://seleniumhq.org/download/maven.html
You should use this Maven dependency :
According to this picture, you don't need a selenium-server dependency:
source : http://seleniumhq.org/download/maven.html