Micro Focus QTP (UFT) Forums

Full Version: Unable to click on a button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everybody,

I encountered a problem while trying to write a qtp script for a webtool. After searching for solutions the last couple of days I really can't imagine how to fix this.

Ok, so the situation is this, I have a webpage that generates a dynamic table. Every row of that table corresponds with a specific demand and starts with 3 buttons (one to view the details of the demand, one to accept the demand and one to cancel the demand) followed be fields with extra info (for example the name of the employee who made the demand). The goal of my script is to accept all the demands of a given employee. I wrote following script:
Code:
max=Browser("My website").Page("My website").WebTable("Demands_Holiday").RowCount
teller=1
Set document=Browser("My website").Object.Document
Set buttonArray=document.getElementsByTagName("INPUT")
buttonAmount=buttonArray.length
msgbox(buttonAmount)
n=0

Do while teller<max
    indexAccept=((teller-1)*3)+1
    indexArray=(((teller-1)*3)+1)+17
    teller=teller+1
    veld=Browser("My website").Page("My website").WebTable("Demands_Holiday").GetCellData(teller,7)
    If veld="Bauer Jack" Then
        Set okButton=Browser("My website").Page("My website").WebButton("type:=button","index:=" & indexAccept)
        okButton.Highlight
        Browser("My website").Page("My website").Syn    
        okButton.Click
    End If
Loop

Now, I added the okButton.Highlight into the script to check if I really selected the correct button, which was the case. However, I get no reaction at all from "okButton.Click" (it seems the button isn't clicked).

I also tried by replacing "okButton.Click" by "buttonArray(indexArray).Click", however I got the same result.

Does anybody knows what I did wrong and how to solve this?
I've got the same problem with you while doing exercise with yahoo mail and gmail.
For yahoo mail, I tried using "button.Submit" and it worked.
I did the same for gmail, but it didn't work this time, still can't find out the solution, I don't wanna click on position on screen, still trying to find another solution...
Hi

Can you try once by changing the if statementas below
Instead of:
Code:
If veld="Bauer Jack" Then
write as:
Code:
If (StrComp(veld,"Bauer Jack")=0) Then
And Please let me know.
Tried it, didn't change anything (which I expected, since I am able to go in the 'If' statement).
HI hellspawn,

Could you attach your current requirement screenshots?
What do you mean by requirement screenshots?
Probably screenshot of your application.