Micro Focus QTP (UFT) Forums
Click object - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Click object (/Thread-Click-object)

Pages: 1 2


Click object - wheelercha - 03-16-2010

I am going through a collection of objects until I find the one I want. Each has a button that I can click to view the object. But for some reason, when I get to my object and say click the button. It is not clicking the button on the row of my object it is clicking the first one.

What can a do to make it click mine? I even get the abs_x and abs_y and it doesn't click it. Is there something I can do like simply Click xcoord,ycoord without doing Browser().Page().WebElement().Click xcoord,ycord because this is not working.

Thanks - Charles


RE: Click object - manishbhalshankar - 03-17-2010

Hi Charls,
Use a counter variable and while going through your collection of objects increment it with 1 for every object till you reach your desired object. Now use the value stored in the counter variable as the index of the button.
Hope this helps.


RE: Click object - wheelercha - 03-23-2010

I have stored the value of the row as 'currentrow'. Can I just say
Code:
For  i = 0 To CurrentRow
    If ElementsCollected(i) = CurrentRow

Is this how I would do that?


RE: Click object - manishbhalshankar - 03-24-2010

If the currentrow has the rowno of your object, then just create an object for button, give its index property the value <currentrow>.


RE: Click object - wheelercha - 03-24-2010

Okay - I figured it out. Thank you so much. I actually just did this :

Code:
If  ElementsCollected(CurrentRow).GetROProperty("innerhtml") = Del Then
                                   ElementsCollected(CurrentRow).Click

If the button here on this row is Delete - Click it.
Now on to the second issue. The Column on the page that holds all of the Delete buttons sometimes includes a blank instead of Delete. So, If my record is the 5th one and there is a blank on the 4th record. So X,X,X, ,X,X. It collects the Deletes, and says I see 5. The Row I want to Delete is 5, but since it is blank, it will go to the 5th 'X' which is really the 6th row.

Is there a way I can set up two object descriptions :

Like this:
Code:
Set oDesc = Description.Create()
                  oDesc("micclass").Value = "WebElement"
                  oDesc("class").Value = "x-grid3-cell-inner x-grid3-col-5"
                  oDesc("innerhtml").Value = "[<SPAN].*"

                'Set nDesc =Description.Create()
                 ' nDesc("micclass").Value = "WebElement"
               '   nDesc("class").Value = "x-grid3-cell-inner x-grid3-col-5"
                 ' nDesc("outerhtml").Value = "[<DIV].*"


And then set the total elements collected to include both? Like grab all Delete buttons and all Blanks. In this way, it will stop at the 5th row, try to Delete it and realize it can't and skip out with a message instead of deleting the wrong record.

So something like this - would it work:
Code:
Set ElementsCollected = Browser("Suppliers and Invoices").Page("Suppliers and Invoices").WebTable("Supplier Payments").ChildObjects(oDesc,nDesc)


How do I get both in the same collection?

Thanks - Charles


RE: Click object - manishbhalshankar - 03-25-2010

Try
PHP Code:
If ElementsCollected(CurrentRow).GetROProperty("innerhtml") = "Delete" Then
   ElementsCollected
(CurrentRow).Click
ElseIf ElementsCollected(CurrentRow).GetROProperty("innerhtml") = "" Then
   ElementsCollected
(CurrentRow).Click
End 
If 



RE: Click object - wheelercha - 04-06-2010

Thank you sir. That works perfectly but rather than look for blanks and Delete, I created an object that counted all rows in that column.


RE: Click object - VikramWakhlu - 06-20-2011

Urgent help needed.

Can I click on an object, just by positioning the cursor on top of it ?

The issue is that I'm trying this on an application which has a drop down menu, which cannot be accessed by a keyboard


RE: Click object - parminderdhiman84 - 06-20-2011

Hello,

Please try the below code:

Code:
Browser().Page().Weblist().FireEvent "onmouseover"

If it doesnt solve ur problem then please elaborate ur problem.

Regards,
Parminder


RE: Click object - VikramWakhlu - 06-21-2011

I'm not working on a web page, but a local application.
and the issue is that I cannot identify or grab the object, or access it by keyboard. it only responds to a mouse over and click.

So I don't think FireEvent will work.