selenium的一个简单的问题,在线求助。

qinxiaofei 2009-03-19 11:22:06
在下面的代码中,如果是用IE测试的话,执行 sele.isElementPresent("rollback_rollback___toolButton") 会得到一个false值,
而如果是用firefox,则会得到一个true,请大家帮一下忙,多谢!


sele.selectFrame("relative=parent");
sele.selectFrame("upg_layout_iframe");
try
{
Thread.sleep(10000);
}
catch (InterruptedException ei)
{
logfile.writeLog(ERROR, ei.getMessage() );
}
logfile.writeLog(INFO, "open the upgrade 'Select ME' page." );

if( !sele.isElementPresent("rollback_rollback___toolButton") )
{
logfile.writeLog(ERROR, "the button \"rollback_rollback___toolButton\" is not exsit or the upgrade page 'Select ME' can not be loaded." );
return false;
}
...全文
124 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aunty_flybird 2009-07-14
  • 打赏
  • 举报
回复
怎么改的呢?
qinxiaofei 2009-03-24
  • 打赏
  • 举报
回复
通过自己的 摸索,这个问题也解决了。
原来是selectFrame()这个函数的问题
我把这个函数修改一下就OK了。
qinxiaofei 2009-03-19
  • 打赏
  • 举报
回复
观察selenium的执行历史记录,IE和firefox是一样的,如下:
为什么同样的操作在IE下就不能获取呢?

firefox:
selectFrame(client)
isElementPresent(frameWorkLayoutMain_layout_iframe)
getAttribute(frameWorkLayoutMain_layout_iframe@style)
selectFrame(frameWorkLayoutLeft_layout_iframe)
click(upgIcon_0)
selectFrame(relative=parent)
selectFrame(upg_layout_iframe)
Same command (4s): isElementPresent(rollback_rollback___toolButton)


IE:
selectFrame(client)
isElementPresent(frameWorkLayoutMain_layout_iframe)
getAttribute(frameWorkLayoutMain_layout_iframe@style)
selectFrame(frameWorkLayoutLeft_layout_iframe)
click(upgIcon_0)
selectFrame(relative=parent)
selectFrame(upg_layout_iframe)
Same command (6s): isElementPresent(rollback_rollback___toolButton)

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧