Micro Focus QTP (UFT) Forums
WebElement is not getting identified in chrome browser but identified in mozilla ,IE - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: WebElement is not getting identified in chrome browser but identified in mozilla ,IE (/Thread-WebElement-is-not-getting-identified-in-chrome-browser-but-identified-in-mozilla-IE)



WebElement is not getting identified in chrome browser but identified in mozilla ,IE - pradeep singh - 05-01-2013

Hi to All,

I am struck in below problem , unable to get understand why qtp behaving differently .

When I run below lines of code for IE or mozilla , it works fine but when I run this same for chrome browser , it throws error.

'******************************************
Code:
' here vrows value is dynamic
For j=1 To vrows
vCommonXpath=".//*[contains (@id,'mainForm:') and @class='ui-datatable-data ui-widget-content']/tr["    
vXpathLastName=vCommonXpath & j & "]/td[2]/div/label"    
    msgbox Browser("login.xhtml").Page("base.xhtml").WebElement("xpath:="& vXpathLastName).GetROProperty("innertext")

Next
'******************************************************
And error thrown only in chrome browser is :
Cannot identify the object "[ WebElement ]" (of class WebElement). Verify that this object's properties match an object currently displayed in your application.


When I stored this xpath in OR for a particular object ,then it works in chrome fine. But I can not use OR for this as object is dynamic. Please help me to resolve above issue.
All patches have already installed as other scripts run fine in all browsers (IE 7,IE8, IE9,mozilla(version12),chrome(version 24)

Please anybody help me as It is very urgent for me.

Thanks & Regards
Pradeep singh


RE: WebElement is not getting identified in chrome browser but identified in mozilla - pradeep singh - 05-01-2013

Please help me as it is urgent for me.


RE: WebElement is not getting identified in chrome - basanth27 - 05-07-2013

Try to add a few more property values to the webelement other than the xpath.


RE: WebElement is not getting identified in chrome browser but identified in mozilla - pradeep singh - 05-07-2013

Hi,

I have also added some other property ,see below but still showing same error in chrome and run fine in other browsers.


'*****************************
Code:
j=1
vCommonXpath=".//*[contains (@id,'mainForm:') and @class='ui-datatable-data ui-widget-content']/tr["    
                                                            vXpathLastName=vCommonXpath & j & "]/td[2]/div/label"                                                        
                                                            vLastName= [b]Browser("login.xhtml").Page("title:=.*").WebElement("xpath:="& vXpathLastName,"html tag:=LABEL","outerhtml:=<label>.*</label>").getroproperty("innertext")[/b]
'                                                            vLastName= Browser("login.xhtml").Page("title:=.*").WebElement("xpath:="&vXpathLastName).getroproperty("innertext")
                                                            msgbox vLastName
'******************************


Also see attached screenshot.


RE: WebElement is not getting identified in chrome browser but identified in mozilla - basanth27 - 05-07-2013

outerhtml:=<label>.*</label> should be
Code:
outerhtml:=<LABEL>.*



RE: WebElement is not getting identified in chrome browser but identified in mozilla - pradeep singh - 05-07-2013

Hi ,

Still same error in chrome.
Why chrome only showing error but runs fine in IE,mozilla ? I have also try with other webelements by mentioning only xpath ,same result as runs fine in mozilla ,IE but can not identify webelement error in chrome. Is xpath (used in dp ) not work for chrome browser?????

Note: I have already installed required patches as other script runs fine in chrome also.

Hi ,

To regenerate issue at your end. Follow below steps.
Step 1: Close all previously opened browsers.
Step 2: Copy and past below line of code in your qtp.
Code:
'msgbox Browser("title:=.*").page("title:=.*").webelement("xpath:=.//*[@id='hplogo']").GetROProperty("innertext")
msgbox Browser("title:=.*").page("title:=.*").webelement("xpath:=.//*[@id='hplogo']","html id:=hplogo","outertext:=India").GetROProperty("innertext")
Step 3: Open firefox browser and navigate to this url: "www.google.co.in"
Step4: Execute above code.
Step 5: You will get the outpout "india" .
Step 6: Now repeat above steps from 3 to 5 but instead of firefox ,now open chrome browser. Now you will get the error.


RE: WebElement is not getting identified in chrome browser but identified in mozilla - pradeep singh - 05-08-2013

Any reply on above ??????????



Thanks & Regards
Pradeep Singh


RE: WebElement is not getting identified in chrome browser but identified in mozilla - pradeep singh - 05-15-2013


Any solution for above problem?