Monday, January 2, 2012

More Xpath for Web Objects

Identifying using Id attribute
obj.WebEdit("xpath:=//input[@id='htmlID']").Set "QTP"
Identifying using Type attribute
obj.WebEdit("xpath:=//input[@type='text'][1]").Set "QTP"'Setting value in first textBox
Identifying using Tagname
obj.WebList("xpath:=//select[1]").Select "London"'Highlighting first listBox
Identifying using Innertext
obj.Link("xpath:=//a[.='Google']").Click'Clicking Google link
Identifying WebTable based on Rowcount
obj.WebTable("xpath:=//table[count(.//tr)=2]").Highlight 'Highlighting the table which has only two rows


More examples will be added