google搜索 51Testing站内搜索                    软件测试门户 | 软件测试培 训 | 文章资料精选 | 软件测试论坛 | 软件测试博客 | 测试招聘求职 
打印

[求助] 在ruby中,怎么获得 DHTML 和 CSS

本主题由 fishy 于 2008-7-2 09:48 移动

在ruby中,怎么获得 DHTML 和 CSS


how to obtain the elements of DHTML and CSS
请问一个问题:
把鼠标放在一个链接上,这个链接会弹出一个气球状的信息框,我们该如何获得这个信息框里面字符串以及字符串的CSS呢?
用Ruby,IE7/firefox

请看这个例子:
1. Go to http://training.active.com/ActiveTrainer/
2. Input username: test1@live.com, password: 111111
3. You will find that, there is a Strength Training on the Calendar page;
4. Put your mouse on the link;
5. There will be a pop-up balloon, there is info in balloon.
如何才能获得这个ballon里面的信息,包括字体样式?

不胜感激

[ 本帖最后由 cjq_999 于 2008-7-1 20:43 编辑 ]

TOP

When I use the method below, I can let the balloon turn up.
$ie.span(:text, "Strength Training").fire_event("onmouseover")

But I still can't make my clicking the link in the balloon.
Anybody helps me?

Thanks.

TOP

lz能给个贴图上来看看吗?


如题。

我这样理解你的问题的。
你是要去点击,workout deatils的link吗?

你这里好像是打包了div->TD->link,如果不对,请lz指正。

你可以尝试用xPath点击那个浮出对话框吗?

希望有帮助。
找啊找啊,找工作……
找来找去,找不到……
[有谁要招小工、临时工、钟点工……] >>  jmy_1981@hotmail.com

TOP

其实你说的对,思路是正确的。
经过左右琢磨,我终于顺利解决这个问题,方法如下:
#让鼠标定位那个链接
$ie.span(:text, 'Strength Training').fire_event("onmouseover")
#等待3秒,这个不能省略!关键就在这儿
sleep(3)
#可以点击了
$ie.link(:text, "workout details").click
#关闭弹出的那个
$ie.image(:src, /button\.png/).click

TOP

We can replace
sleep(3)
with
wait_until{ $ie.link(:text, "workout details").exists? }

I think it is much better, don't need to care about the network speed,

TOP

 
当前时区 GMT+8, 现在时间是 2008-10-13 23:31Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹