QTP Forums

Full Version: Issues with Browser Name which has Pipe Symbol (|)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

QTP fails to recognize the object's parent(Browser) if the Browser name is like "Yahoo Site | Mail" (pipe symbol in Browser name). I am dynamically capturing Browser name and Page Title and executing the script.

Sample Script:
-------------
SignUpObjName = "test.gif"
BrowserName=Browser("micclass:=Browser").GetROProperty("name")
PageName=Browser("micclass:=Browser").Page("micclass:=Page").GetROProperty("title")
Browser("name:=" & BrowserName).Page("Title:="& PageName).Image( "file name:=" &SignUpObjName).Click


I got the following Run Error:

"Cannot find the "[Image]" Object's parent "[Browser]" (class Browser). VErify that parent properties match an object currently displayed in your application"

Note1: If we have Object Repository for same Browser (say "Yahoo Site | Mail") we didn't get any error and execution is successful.

Note2: Script works fine for other Browsers which don't have Pipe symbol in their name.

Please share your ideas on this.

Vijay
Pipe means OR in regular expression. So QTP is taking it as Yahoo site OR Mail. Escape pipe with backslash and it would work fine.
Code:
Ex: "Yahoo Site \| Mail"
Thank you very much. Its working fine now.
Can you tell me how did you make this work...

it will be great if you can show the script to do this.

Thanks in advance


(03-20-2009 04:21 PM)dvkbabu Wrote: [ -> ]Thank you very much. Its working fine now.
Hi UjwalaK,

The solution is there in Ankur's Post.
Regularise the text in your OR.
(12-29-2009 06:52 PM)UjwalaK Wrote: [ -> ]Can you tell me how did you make this work...

it will be great if you can show the script to do this.

Thanks in advance


(03-20-2009 04:21 PM)dvkbabu Wrote: [ -> ]Thank you very much. Its working fine now.



Hi UjwalaK
you can use the below coding for the same,

SignUpObjName = "117112.jpg"
BrowserName = Replace(Browser("micclass:=Browser").GetROProperty("name"),"|","\|")
PageName=Replace(Browser("micclass:=Browser").Page("micclass:=Page").GetROProperty("title"),"|","\|")
Browser("name:=" & BrowserName).Page("Title:="& PageName).Image( "file name:=" &SignUpObjName).Click


Thanks,
Srikanth
Reference URL's