Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP not recognizing the webelement
#1
Hi, I am trying to validate if a webelement property exists on the page or not. But QTP always returns true Sad and not going to Else part . Below is my code. pls help Sad
************************************************************
Code:
BlnResult = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").Exist(0) Then Msgbox "Success" Else Msgbox "Fail" End If
************************************************************
QTP always true even in case if web element doesn't exist on the page.
Reply
#2
check the x,y values of the webelement if the values are <0 then you can consider that the object does not exist on the page.
Below is the pseudo code....

Code:
BlnResult = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").Exist(0) Then intX = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").GetROProperty("X") intY = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").GetROProperty("Y") If (intX>0 and intY>0) then Msgbox "Success" Else Msgbox "Fail" End If Else Msgbox "Fail" End If
Thanks,
SUpputuri
Reply
#3
Hi,

values are positive only ... Moreover when i try to do object spy for the webelement (when the object doesnt exist on the page), QTP recognizes the page but not highlighting anything. Does it mean object exists on the page (like hidden)? Expectation is, QTP should throw a pop up saying "object doesn't exists on the application". Am i right ?
Reply
#4
try with this
Code:
WebElement("File Upload successfully").getroproperty("visible")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP recognizing every JavaEdit as "VTextField" having different index values. K Gaurav Varshney 1 2,810 10-29-2012, 11:51 AM
Last Post: krr
  Application and QTP freezes when recognizing/selecting Java Tab pora 4 7,510 01-10-2012, 10:11 PM
Last Post: sunnyk8
  QTP Webelement with Html tag as OPTION pjr 0 7,479 01-30-2011, 05:33 AM
Last Post: pjr
  QTP Not Recognizing WebElement Sathiyakum 6 11,392 01-27-2011, 07:46 PM
Last Post: Arun Prakash
  QTP WebElement Click Help Anilkr 1 9,214 02-04-2010, 01:35 PM
Last Post: sreekanth chilam

Forum Jump:


Users browsing this thread: 1 Guest(s)