Micro Focus QTP (UFT) Forums
Unable to click on a button - 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: Unable to click on a button (/Thread-Unable-to-click-on-a-button)



Unable to click on a button - hellspawn - 11-19-2010

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?


RE: Unable to click on a button - ngocvo3103 - 11-19-2010

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...


RE: Unable to click on a button - KavitaPriyaCR - 11-19-2010

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.


RE: Unable to click on a button - hellspawn - 11-19-2010

Tried it, didn't change anything (which I expected, since I am able to go in the 'If' statement).


RE: Unable to click on a button - sreekanth chilam - 11-19-2010

HI hellspawn,

Could you attach your current requirement screenshots?


RE: Unable to click on a button - hellspawn - 11-19-2010

What do you mean by requirement screenshots?


RE: Unable to click on a button - manishbhalshankar - 11-30-2010

Probably screenshot of your application.