Micro Focus QTP (UFT) 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.
Pages: 1 2
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:
-------------
Code:
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
Hi UjwalaK,

The solution is there in Ankur's Post.
Regularise the text in your OR.
Hi UjwalaK
you can use the below coding for the same,

Code:
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
Hi ,

I was also trying the above code. On an application I was trying to click on a link " Home". I have used descriptive programming and efined it with enough properties.

Code:
BrowserName=Browser("micclass:=Browser").GetROProperty("name")
                PageName=Browser("micclass:=Browser").Page("micclass:=Page").GetROProperty("title")

Browser("name:=" &BrowserName).Page("Title:="&PageName).Link(Obj_home).Click
but last line doesnt work. It says Link object properties matches with some other objects. But I added all mandatory prop, but still no luck
Can anyone reply my query???
scenario is that, I have a home button. I need to click this buton on page1 first and page 2 second.

Now when I object spy on first page I see page title prop is diff.
same thig happens for page also.

Hence I used regular expression as I didnt wanted to add those objects in Object repository.

Code:
If Browser("name:=Mobile.*","Creationtime:=0").Page("tilte:=Mobile.*").Link(Obj_Mobiles).Exist(2)   then
        Browser("name:=Mobile.*","Creationtime:=0").Page("tilte:=Mobile.*").Link(Obj_Mobiles).Click

This also didnt work. Please note I have used descriptive programming for Obj_Mobiles
What was the error dispalyed ??
Pages: 1 2