如何解决selenium 2.0 webdriver测试编译错误
| 无论我使用哪个Selenium 2.xx版本的Web驱动程序,我都会得到相同的编译错误 :错误读取C:\\ Documents和 设置\\ kondojis.m2 \\存储库\\ org \\ seleniumhq \\ selenium \\ selenium-firefox-driver \\ 2.0b3 \\ selenium-firefox-driver-2.0b3.jar; 打开zip文件时出错 这就是我的POM文件中的内容<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium</artifactId>
<version>2.0rc2</version>
<type>pom</type> <i tried with and without type pom>
</dependency>
我正在使用jdk 1.6,Maven 3.0.1,正在Windows XP上使用Maven编译器插件2.3.2等
package com.usps.mgo.icoa.UI;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.apache.log4j.Logger;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.util.List;
import java.util.Locale;
/**
* Created by IntelliJ IDEA.
* User: kondojis
* Date: 2/8/11
* Time: 5:02 PM
* To change this template use File | Settings | File Templates.
*/
public class SimulatorTests {
private static final Logger logger = Logger.getLogger(SimulatorTests.class);
private static WebDriver driver;
private ReloadableResourceBundleMessageSource messageSource;
private static ClassPathXmlApplicationContext springCtx;
/**
* Properties for Simulator tests
*/
@Before
public void setUp() {
// Bootstrap Spring Framework.
springCtx = new ClassPathXmlApplicationContext(
new String[]{\"test-config.xml\"});
//Make Sure that test_global.properties file is always in sync with the global.properties file from production.
messageSource = springCtx.getBean(\"messageSource\",ReloadableResourceBundleMessageSource.class);
driver = new FirefoxDriver();
}
解决方法
打开zip文件时出现错误,听起来像是本地存储库中的jar损坏。尝试删除\“ C:\\ Documents and Settings \\ kondojis.m2 \\ repository \\ org \\ seleniumhq \\ selenium \\ selenium-firefox-driver \\\”目录,并使maven重新下载它。
编辑:注意到您的硒依赖性和错误输出具有不同的版本,我声明一个手动依赖性,如
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.0rc2</version>
<scope>test</scope>
</dependency>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。