abnv
abnv

Reputation: 45

Unable to identify Web object in UFT for webpage?

SystemUtil.Run "iexplore.exe", "https://www.jetairways.com/EN/IN/Home.aspx"  
wait (7)  
Set traverse=Browser("Jet Airways: Airlines").Page("Jet Airways: Airlines")  

traverse.WebEdit("placeholder:=From").Click  

traverse.Link("acc_name:=      This link will open Popup window for airport     selection.  ").WebElement("innerhtml:=All Airports","innertext:=All     Airports","outerhtml:=<strong>All Airports </strong>").Click  

traverse.WebTabStrip("html id:=ToC").Link("innerhtml:=Africa","innertext:=Africa").Click  
Set oDesc = Description.Create   
oDesc( "micclass" ).value = "Link"   
oDesc( "href" ).value = "https://www.jetairways.com/EN/IN/Home.aspx#"    
Set rc=Browser("creationtime:=0").Page("micClass:=page").ChildObjects(oDesc)  
msgbox rc.count  

UFT is not bale to identify the link, lets say, Johanesber or Port Elizabeth,etc This is actually not working. Have tried many ways . Can some one help me fix this?

Upvotes: 1

Views: 861

Answers (2)

Motti
Motti

Reputation: 114695

The following code works for me, I cleaned up some of the spaces (and simplified the description a bit). I don't understand what you were trying to accomplish with the last lines of your script (counting the links).

I think the problem you were facing was probably to do with the fact that when you use descriptive programming (either inline with := or using a Description object), the values are used as regular expressions and not as plain strings. This means you have to escape regular expression characters (in this case ( and )) or else the values won't match.

Set traverse=Browser("Jet Airways: Airlines").Page("Jet Airways: Airlines")  

traverse.WebEdit("placeholder:=From").Click

traverse.Link("acc_name:=This link will open Popup window for airport selection.").WebElement("html tag:=strong").Click

traverse.WebTabStrip("html id:=ToC").Link("innerhtml:=Africa","innertext:=Africa").Click 

traverse.Link("innertext:=Port Elizabeth \(PLZ\)").Click ' Note \( and \)

Upvotes: 2

Nav
Nav

Reputation: 19

Try to write the link object and the pop up window object in two different lines traverse.Link("acc_name:= This link will open Popup window for airport selection. ")

traverse.WebElement("innerhtml:=All Airports","innertext:=All Airports","outerhtml:=<strong>All Airports </strong>").Click 

also try to use Regex if the property values contains spaces or symbols.

Upvotes: 1

Related Questions