Hi All,

I'm having problem handling javascript confirmation box (OK/Cancel).
I already managed to click a button at runtime, but I need to bypass this confirmation box, or
able to select ok.

Here is the html of the script

HTML Code:
<input type="submit" name="btnpch" value="Purchace" onclick="return confirmation();" id="plchldr001" style="width:100px;" />
Instead of calling the confirmation, I simply change the outerHtml to :

HTML Code:
<input type="submit" name="btnpch" value="Purchace" onclick="return true;" id="plchldr001" style="width:100px;" />
When I click the button manually on the page, It will simply bypass the confirmation and proceed submitting the page. Its seems to be working well.

But when I execute these code :


Code:
                    
Dim doc As HtmlDocument = WebBrowser1.Document
Dim aC As HtmlElementCollection = doc.GetElementsByTagName("input")
For Each he As HtmlElement In aC
        If he.GetAttribute("name") = "btnpch" Then
             he.InvokeMember("onclick")
         End If
Next
It sill shows the confirmation. I noticed that When click manually on the button, it will skip the confirmation, but not if I click the button by code.

What I do wrong here? Or any other solution to achieve this?

I know a lot of posts out there already talking about this issues, but none seem to work for me.



Thanx in advance...........