2016-12-13 55 views
0

我是新来硒UI元素,在此之前我总是选择硒IDE.When我试图用汇总命令,我在uimap.js文件中定义一个汇总经理:硒元素汇总未发现

myRollupManager.addRollupRule({ 
    name: 'login_in' 
    , description: 'login' 
    , pre: 'xxx' 
    , post: 'xxx' 
    , commandMatchers: [] 
    , expandedCommands: [ 
    { 
     command: 'click' 
     , target: 'loginbutton' 
    } 
    ] 
}); 

的loginbutton元件是这样的:

myMap.addElement('LoginPages', { 
    name: 'loginbutton' 
    , description: 'login button' 
    , locator: "//*[@id='login-form']/*/button" 
}); 

但是当我在执行IDE以下命令:

|command|target|value| 
|click|login_in|| 

我总是得到“元素loginbutton未找到”错误:

|command|target|value| 
|click|//*[@id='login-form']/*/button|| 
|click|//xpath=//*/button|| 

我也试过:

我试过很多种的XPath定位器,当谈到没有汇总到IDE他们每个人的工作正常当定位器是“locator:”xpath = // * [@ id ='xxx']“”时,它具有id属性的输入元素,这工作得很好,我真的无法弄清楚发生了什么。有人遇到类似的问题吗?

回答

0
target:'loginbutton' 

不会work.that是一个定位器,而不是一个UI的element.Change它:

{ 
    command: 'click' 
    , target: 'ui=LoginPages::loginbutton()' 
    //'login_button' will not work.that's a locator,not an ui-element 
}