English 中文(简体)
QTP - 取得要素价值
原标题:QTP - getting value of element

I am beginning with QTP and just cannot find out how to get value of element. For example when I just want to compare the number of results found by google. I tried to select the element with object spy and use Val(Element) to assign the value into variable..but it doesnt work. Could anyone help with this? BTW, I am not sure whether selecting the text (element) to compare with Object spy is correct. Thanks!

最佳回答

您应使用<代码>GetROProperty,以便获取案文,然后按价值加以分类。

查看谷歌成果页一看,结果在第3个黑体中,是带<条码>的。

 <p id="resultStats"> Results <b>1</b> - <b>10</b> of about 
    <b>2,920,000</b> 
 for <b>qtp</b>. (<b>0.22</b> seconds)</p>

因此,下面的文字是编号(用 com体加)。

Browser("micclass:=Browser")
 .Page("micclass:=Page")
  .WebElement("html id:=resultStats")
   .WebElement("html tag:=b","index:=2").GetROProperty("innertext")
问题回答

暂无回答




相关问题
QTP - testing while browser/page title changes

I am trying to make simple testing but failed because I have no clue how to handle with browser title that changes during the testing. Simple example: Google>Find "blabol" Once its done, the browser ...

QTP - 取得要素价值

我从QTP开始,仅仅找不到如何获得要素的价值。 例如,当我只想比较一下从山洞中发现的成果数量时。 我试图用物体选择这个要素......

Record enter button in qtp

How to record ENTER button that we use through the keyboard in QTP for applications

How do you write your QTP Tests?

I am experimenting with using QTP for some webapp ui automation testing and I was wondering how people usually write their QTP tests. Do you use the object map, descriptive programming, a combination ...

Dynamically building a URL in QTP

I ve been taking a quick look at QTP with one of our test team. We ve figured out some basics like recording a test, capturing text using output values, putting in check points, etc. However, I can ...

热门标签