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

[求助] How to deal with the symbol & in a text?

How to deal with the symbol & in a text?


When I use the method:
$ie.element_by_xpath("//td[contains(text(),'Log as Complete')]").click
I can click an option "Log as Complete" in a  dynamic menu as I want.
In the menu, there is another option: Edit & Log
When I use
$ie.element_by_xpath("//td[contains(text(),'Edit & Log')]").click
I can't succeed.

How can I deal with the problem and click "Edit & Log" successfully?
Please see the enclosed pic.

Thanks.
Wesley.
附件: 您所在的用户组无法下载或查看附件

TOP

Now, I have solved the problem, using ‘&’ instead of '&'.
Both the two methods below can work.
$ie.link(:xpath, "//td[contains(text(),'Edit & Log')]").fire_event("onclick")
$ie.element_by_xpath("//td[contains(text(),'Edit')]").click

[ 本帖最后由 cjq_999 于 2008-7-18 08:56 编辑 ]

TOP

I don't think use Xpath to get an element  is good for watir, this may be better

ie.div(:id, "mtDropDown0").table(:id, "some info").cell(:text,"some text")

Hope it helps.

TOP

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