单击“添加评论”按钮

时间:2013-03-07 20:44:06

标签: record selenium-ide playback

当我录制我的脚本时,我的scrpit在点击“添加评论”图标时失败了。我得到的错误是找不到元素。 html脚本是:

a id =“cmt_place”class =“btn add_comment”onclick =“javascript:SNI.Community.Toolbox.TopNavCheckandShow()”>

所以我很困惑我应该使用哪个命令以及目标和值应该是什么,以便在测试运行时它应该能够自动单击添加注释图标。

新测试用例

open    /registration/login.esi     
type    id=up-ur-email             
type    id=up-ur-password       

click   css=#up-ur-widget-login > #up-ur-widget-nav-item-off > a > em   
open    /home/home.esi  
click   link=TEST_upload    
click   id=Add Comment  
click   id=commenttext  
type    id=commenttext                test123
click   css=#post-comment-omnt > em     
clickAndWait    link=Log Out    

2 个答案:

答案 0 :(得分:0)

open    /registration/login.esi     
type    id=up-ur-email             
type    id=up-ur-password       

click   css=#up-ur-widget-login > #up-ur-widget-nav-item-off > a > em   
open    /home/home.esi  
click   link=TEST_upload 
Pause   30000
click   id=Add Comment  
click   id=commenttext  
type    id=commenttext                test123
click   css=#post-comment-omnt > em     
clickAndWait    link=Log Out    


pause command will pause 3 second before click the  Add comment button. 

Try this.

Thank you.

答案 1 :(得分:0)

在目标字段中使用评论框的Xpath并使用pause& setCursorPosition命令 暂停等待一段时间并将setCursorPosition命令指向评论框

open    /registration/login.esi     
type    id=up-ur-email             
type    id=up-ur-password       
click   css=#up-ur-widget-login > #up-ur-widget-nav-item-off > a > em   
open    /home/home.esi  
click   link=TEST_upload   
click   id=Add Comment(use Xpath of comment box instead of this)
pause   2000
setCursorPosition   id=commenttext
click   id=commenttext  
type    id=commenttext                test123
click   css=#post-comment-omnt > em     
clickAndWait    link=Log Out