Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WebElement not found in OR
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Sometimes it is difficult to verify webelements text if their properties change dynamically, in these situations the other way round is to verify whether the expected message is displayed on the page or not.

Code:
Set oPage = Browser().Page()
Set oDescWebElement = Description.Create
oDescWebEement("micclass").value = "WebElement"
oDescWebElement("visible").value = True
bFndFlag = False
Set colWebElements = oPage.ChildObjects(oDescWebElement)
For iCnt=0 to colWebElements.Count-1 Step 1
      If colWebElements(iCnt).GetROProperty("outertext") = "Expected Text" Then     ' use Instr if specific text needs to be checked
           bFndFlag = True
           Exit For
      End If
Next
If bFndFlag = True Then
     Print "passed: text found on the page"
Else
     Print "failed: text not found on the page"
End If

An alternative way would be to capture the text as displayed in Page source using msxml object. For details on msxml object refer book ' Test automation and qtp - excel with ease'

Sometimes it is difficult to verify webelements text if their properties change dynamically, in these situations the other way round is to verify whether the expected message is displayed on the page or not.

Code:
Set oPage = Browser().Page()
Set oDescWebElement = Description.Create
oDescWebEement("micclass").value = "WebElement"
oDescWebElement("visible").value = True
bFndFlag = False
Set colWebElements = oPage.ChildObjects(oDescWebElement)
For iCnt=0 to colWebElements.Count-1 Step 1
If colWebElements(iCnt).GetROProperty("outertext") = "Expected Text" Then ' use Instr if specific text needs to be checked
bFndFlag = True
Exit For
End If
Next
If bFndFlag = True Then
Print "passed: text found on the page"
Else
Print "failed: text not found on the page"
End If

An alternative way would be to capture the text as displayed in Page source using msxml object. For details on msxml object refer book ' Test automation and qtp - excel with ease'
Sometimes it is difficult to verify webelements text if their properties change dynamically, in these situations the other way round is to verify whether the expected message is displayed on the page or not.

Set oPage = Browser().Page()
Code:
Set oDescWebElement = Description.Create
oDescWebEement("micclass").value = "WebElement"
oDescWebElement("visible").value = True
bFndFlag = False
Set colWebElements = oPage.ChildObjects(oDescWebElement)
For iCnt=0 to colWebElements.Count-1 Step 1
If colWebElements(iCnt).GetROProperty("outertext") = "Expected Text" Then ' use Instr if specific text needs to be checked
bFndFlag = True
Exit For
End If
Next
If bFndFlag = True Then
Print "passed: text found on the page"
Else
Print "failed: text not found on the page"
End If

An alternative way would be to capture the text as displayed in Page source using msxml object. For details on msxml object refer book ' Test automation and qtp - excel with ease'
Reply


Messages In This Thread
WebElement not found in OR - by mv8167 - 03-24-2012, 12:45 AM
RE: WebElement not found in OR - by rajeevszone - 03-25-2012, 06:13 AM
RE: WebElement not found in OR - by rajeevszone - 03-25-2012, 06:13 AM
RE: WebElement not found in OR - by mv8167 - 03-26-2012, 09:37 PM
RE: WebElement not found in OR - by sshukla12 - 03-27-2012, 11:49 AM
RE: WebElement not found in OR - by mv8167 - 03-27-2012, 06:53 PM
RE: WebElement not found in OR - by mv8167 - 03-27-2012, 09:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  regex works but how do i return the found string to a variable jove1776 2 3,422 08-24-2011, 06:17 PM
Last Post: jove1776

Forum Jump:


Users browsing this thread: 1 Guest(s)