51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4995|回复: 1
打印 上一主题 下一主题

com.thoughtworks.selenium.SeleniumException:

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-4-23 17:47:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
代码如下:
package com.testscripts;

import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;

public class Untitled extends SeleneseTestCase {
       
    public void setUp() throws Exception {
        setUp("http://bbs.51testing.com", "*iexplore");
    }
      /**
     * @throws Exception
     */
    public void testNew() throws Exception {
          selenium.open("/");
          selenium.waitForPageToLoad("30000");

    }
    public static void main(String[] args) throws Exception  {
            Untitled u=new Untitled();
            u.setUp();
            u.testNew();
    }
}
---------------------------------------------------------------------------------------------
执行后,能打开 51testing的页面,但是会报如下错误:
Exception in thread "main" com.thoughtworks.selenium.SeleniumException: Timed out after 30000ms
        at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
        at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
        at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:353)
        at com.testscripts.Untitled.testNew(Untitled.java:17)
        at com.testscripts.Untitled.main(Untitled.java:25)
从Server 日志看应该是在执行open时,超时了,不知道是什么原因
server日志:
17:42:48.024 INFO - Command request: getNewBrowserSession[*iexplore, http://bbs.
51testing.com, ] on session null
17:42:48.024 INFO - creating new remote session
17:42:48.024 INFO - Allocated session de0bac9956ef43d99ab9a78252284806 for http:
//bbs.51testing.com, launching...
17:42:49.025 INFO - Launching Embedded Internet Explorer...
17:42:50.037 INFO - Launching Internet Explorer HTA...
17:42:52.280 INFO - Got result: OK,de0bac9956ef43d99ab9a78252284806 on session d
e0bac9956ef43d99ab9a78252284806
17:42:52.290 INFO - Command request: open[/, ] on session de0bac9956ef43d99ab9a7
8252284806
17:43:22.383 INFO - Got result: Timed out after 30000ms on session de0bac9956ef4
3d99ab9a78252284806
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2010-4-25 14:27:56 | 只看该作者
你代码我以java application和junit方式执行都可以。

看到你import testng。我用testng执行也没有问题。奇怪了!
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-22 01:23 , Processed in 0.077873 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表