Micro Focus QTP (UFT) Forums
Issues with Browser Name which has Pipe Symbol (|) - 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: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: Issues with Browser Name which has Pipe Symbol (|) (/Thread-Issues-with-Browser-Name-which-has-Pipe-Symbol)

Pages: 1 2


Issues with Browser Name which has Pipe Symbol (|) - dvkbabu - 03-19-2009

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


RE: Issues with Browser Name which has Pipe Symbol (|) - Ankur - 03-19-2009

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"



RE: Issues with Browser Name which has Pipe Symbol (|) - dvkbabu - 03-20-2009

Thank you very much. Its working fine now.


RE: Issues with Browser Name which has Pipe Symbol (|) - UjwalaK - 12-29-2009

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


RE: Issues with Browser Name which has Pipe Symbol (|) - Saket - 12-30-2009

Hi UjwalaK,

The solution is there in Ankur's Post.
Regularise the text in your OR.


RE: Issues with Browser Name which has Pipe Symbol (|) - srikanthqtp - 01-07-2012

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


RE: Issues with Browser Name which has Pipe Symbol (|) - nikhilcogni - 03-17-2013

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


RE: Issues with Browser Name which has Pipe Symbol (|) - nikhilcogni - 03-19-2013

Can anyone reply my query???


RE: Issues with Browser Name which has Pipe Symbol (|) - nikhilcogni - 03-19-2013

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


RE: Issues with Browser Name which has Pipe Symbol (|) - Benak - 04-17-2013

What was the error dispalyed ??