selenium测试问题-简单

easy_work 2015-09-17 10:00:53
想研究下selenium2.0怎么用,从网上找了些代码,但是运行时出现了问题,请问谁知道解决办法,或者有简单的测试工程打包给我发一个,我练练手,谢谢。我的邮箱 seabird_2000@163.com
目前遇到的问题是,执行到WebDriver driver = new FirefoxDriver()就停住了,火狐弹出来了,也没有马上报错。但是没有继续往下执行,也没有输出2,System.out.println("2");

package com.selenium;

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;

public class TestHello {
WebDriver driver;

@Test
public void helloWorld() throws Exception {
System.out.println("start firefox browser...");
System.setProperty("webdriver.firefox.bin", "D:/Program Files (x86)/Mozilla Firefox/firefox.exe");
System.out.println("1");
WebDriver driver = new FirefoxDriver();
System.out.println("2");
Navigation navigation = driver.navigate();
System.out.println("3");
navigation.to("http://www.baidu.com/");
System.out.println("start firefox browser succeed...");
}
}
...全文
74 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
have a look
回复
have a look
回复
have a look
回复
easy_work 2015-09-17
报错了,错误信息如下: java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.transformValues(Lcom/google/common/collect/ListMultimap;Lcom/google/common/base/Function;)Lcom/google/common/collect/ListMultimap; at com.google.common.net.MediaType.toString(MediaType.java:708) at org.openqa.selenium.remote.http.JsonHttpCommandCodec.encode(JsonHttpCommandCodec.java:214) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:131) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:170) at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:393) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:223) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:212) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125) at com.selenium.TestHello.helloWorld(TestHello.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-09-17 10:00
社区公告
暂无公告