硒命令 [英] Selenium Command

查看:73
本文介绍了硒命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们那时使用selenium命令时,找不到命令和属性没有得到?见下面的命令。

When we use selenium command at that time command not find and attribute not get? See below command.

<table>
  <tr><td>open</td><td>http://www.wikipedia.org/</td><td></td></tr>
  <tr><td>verifyAttribute</td><td>css=input#searchInput</td><td>(Search Input)</td></tr>
  <tr><td>assertAttribute</td><td>css=input#searchInput</td><td>(Search Input)</td></tr>
  <tr><td>verifyAttribute</td><td>css=input#searchInput</td><td>language</td></tr>
  <tr><td>verifyAttribute</td><td>xpath=//div[2]@class central-featured</td><td>central-featured</td></tr>
  <tr><td>verifyAttribute</td><td>xpath=//div[2]@class central-featured</td><td>search1</td></tr>
  <tr><td>assertAttribute</td><td>xpath=//div[2]@class central-featured</td><td>central-featured</td></tr>
</table>

我正在Mozilla Firefox和Ubuntu中使用Selenium IDE 2.5.0。

I am using Selenium IDE 2.5.0 in Mozilla Firefox and Ubuntu.

推荐答案

Xpath // div [2] @class Central-featured 无效。如果您要选择班级,请尝试将其更改为 // div [@ class ='central-featured'] / @ class
如果要检查元素是否存在,也可以使用 assertElementPresent 函数代替选择属性,即:
< tr< td> assertElementPresent< / td>< td> xpath = // div [@ class ='central-featured'] < td>< / td< / tr>
这样简单得多。

Xpath //div[2]@class central-featured is invalid. Try changing it to //div[@class='central-featured']/@class if you mean to select a class. You could also use assertElementPresent function instead of selecting attribute, if the whole point is to check that element exists, i.e.: <tr><td>assertElementPresent</td><td>xpath=//div[@class='central-featured']</td><td></td></tr> Much simpler that way.

这篇关于硒命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆