Micro Focus QTP (UFT) Forums
How to select a webelement - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to select a webelement (/Thread-How-to-select-a-webelement)

Pages: 1 2


How to select a webelement - silpavinod - 10-09-2012

Hi,

I am having some web elements in a page . how to select it


RE: How to select a webelement - ssvali - 10-09-2012

Please provide info like screen shot , Object spy properties


RE: How to select a webelement - silpavinod - 10-10-2012

I am having a dropdown and in that i am having 8 webelements.
when i spy the dropdown it is showing as webedit inside webtable. How i need to select one value from dropdown.

I tried my setting value to webedit like
Code:
Browser(" ").page(" ").Webtable(" ").webedit(" ").set "some value"
But is it is giving a msg like object is disable.

I tried by childobjects and got the count of the webelements but is showing 6 but i am having 8 webelements and default value is select.

Please help me on the same...


RE: How to select a webelement - harishshenoy - 10-11-2012

Hi ,

Try to click on the drop down arrow , which will display as 'webelement' in qtp and then in the next statement try to validate the options or click on the option , I think even the options will displayed as 'web element'.

like:
Code:
browser().page().webelement("The down arrow button").click
If browser().page().webelement("The option").exist then

end if


RE: How to select a webelement - silpavinod - 10-11-2012

I tired this but here i am checking the particular element exist or not. if exits clicking... other wise else case.

But for this i need to add very webelement into object repository rite... i think we cant do like this bec we will be passing the one of the value frm datatable...

Suppose we are having 8 web elements we need to add 8 webelements in OR?

am i thinking i rite way ? help me...

Thanks in advance
SilpaVinod


RE: How to select a webelement - harishshenoy - 10-11-2012

Hi ,
No need to add them into the repository.
try to use the array and descriptive programing:
keep the unique property like 'innertext' in the array.
Code:
list_items = array("item1" , "item2" ,......"item8")

browser().page().webelement("arrow").click

for i = 0 to ubound(list_items)
if browser().page().webelement("class:=use class" , "innertext:=" & list_items(i)).exist then

print "pass"
else
print "fail"
end if
next


Note: use the identification property like 'class' , 'html id' with the use of regular expression to identify the list items , and 'innertext' to make them unique.


RE: How to select a webelement - silpavinod - 10-12-2012

Ya it is working fine thanks


RE: How to select a webelement - mshivnath - 07-13-2014

Hi,
when i am syping the object it is showing as Webelement, i am not able to identify the object what to do?


RE: How to select a webelement - spchan - 01-05-2016

Hi, I got the following error while using UFT 12.51 :

Cannot identify the object "Create branch:new_branch" (of class WebElement)

My code:


Code:
email_addr = "sp@xxx.com"
    pwd = "12Ka10##"
    repo = "shanti-testrepo"
    uid = "sp"
    new_branch = "branch8"

SystemUtil.Run "IExplore.exe", "https://github.com"

Browser("Sign in via LDAP · GitHub").Page("Sign in via LDAP · GitHub").WebEdit("login").Set "sp@xxx.com"
Browser("Sign in via LDAP · GitHub").Page("Sign in via LDAP · GitHub").WebEdit("password").SetSecure "568a9c124918796c14dda31b0d833acefa6c5089281f"
Browser("Sign in via LDAP · GitHub").Page("Sign in via LDAP · GitHub").WebButton("Sign in").Click
Browser("Sign in via LDAP · GitHub").Page("GitHub").Link("repo").Click
Browser("Sign in via LDAP · GitHub").Page("uid/repo").WebEdit("Find or create a branch…").Set new_branch
Browser("Sign in via LDAP · GitHub").Page("uid/repo").WebElement("Create branch: new_branch").Click



Any help is highly appreciated.


RE: How to select a webelement - vinod123 - 01-06-2016

can u send page screenshot and did you try other properties