[VB.NET] InvokeScript / click item in html tablet

11/23/2013 14:14 BeginnerDO#1
Hi,

Now I'll give up trying myself and I'm gonna ask your help :)
So I have web browser in my project and I'm trying to run javascript from the wep page. The script it below:

Code:
function startProvinciarumFight(aType, userId, serverId,country)
{
arenaType = aType;
provinciarumDefenderId = userId;
provinciarumServer = serverId;
provinciarumCountry = country;
sendRequest('get', 'ajax.php', 'mod=arena&submod=doCombat&aType='+arenaType+'&opponentId='+userId+'&serverId='+serverId+'&country='+country, 'attack_player_'+serverId + userId, 'arena_spinner', 'arena_spinner-img', 'arena_spinner-content');
}
This script can be run also by clicking image in the Html tablet in the same page:
Code:
<tr>
                                        <td>
                                            <a target="_blank" href="Link">
                                                                                                    [string]                                                                                           </a>
                                        </td>
                                        <td>[integer]</td>
                                        <td>
                                            [integer]                                        </td>
                                        <td>
                                            <span onclick="startProvinciarumFight(2, 45151, 5, 'fi');">
                                                <img style="cursor:pointer" src="7726/img/fordern.gif">
                                            </span>
                                            <span id="attack_player_545151" style="height: 20px; width: 20px;"></span>
                                        </td>
                                    </tr>
There nothing has id so that causes problems for me...

I can get those objects (2,45151,5,fi) easily - thats not a problem. I have tried to do this way:
Code:
'teksti() is the correct object (2, 15151, 5, 'fi')'
Dim ObjArr(3) As Object
            ObjArr(0) = CObj(New String(teksti(0)))
            ObjArr(1) = CObj(New String(teksti(1)))
            ObjArr(2) = CObj(New String(teksti(2)))
            ObjArr(3) = CObj(New String(teksti(3)))
            WaitForPageLoad()
            Webbrowser.Document.InvokeScript("startProvinciarumFight", ObjArr)

'or simple this way:'
Webbrowser.Document.InvokeScript("startProvinciarumFight", _
                    New Object() {teksti(0), teksti(1), teksti(2), teksti(3)})
Do you have any idea what is wrong with that "invokeScript"? Or do you know how I could click html item in tha table that has no id?
12/13/2013 14:36 BeginnerDO#2
anyone? :)
12/13/2013 15:26 'Heaven.#3
Code:
If (Not (WebBrowser1.Document Is Nothing)) Then
        Dim ObjArr(4) As Object
        ObjArr(0) = CObj(New String(teksti(0)))
        ObjArr(1) = CObj(New String(teksti(1)))
        ObjArr(3) = CObj(New String(teksti(2)))
        ObjArr(4) = CObj(New String(teksti(3)))
        WebBrowser.Document.InvokeScript("startProvinciarumFight", ObjArr)
    End If

[Only registered and activated users can see links. Click Here To Register...]