abhi111abhishek / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 0 forks source link

Is it possible to do multithreading? #65

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system :
.Net Framework version :
Office Version :
SeleniumWrapper version :

What is your issue ?

I want to know Is it possible to do multithreading? Suppose want to opening 10 
website and filling form simultaneously.

If so , please show an example or is there any alternative solution

Thanks in advance 

Original issue reported on code.google.com by shan4sha...@gmail.com on 12 Apr 2014 at 8:33

GoogleCodeExporter commented 9 years ago
VBA and VBS don't support Multithreading.
However, it's possible to perform automation simultaneously by executing 
multiple VBS scripts asynchronously and wait for the end of each one.

An example which runs 2 scripts and waits for the end:

Set wsh = CreateObject("WScript.Shell")
Set queue = CreateObject("System.Collections.ArrayList")

queue.Add wsh.Exec("cscript //Nologo ""c:\scriptA.vbs""")  'execute script A
queue.Add wsh.Exec("cscript //Nologo ""c:\scriptB.vbs argument1 argument2""")  
'execute script B with 2 arguments

'Waits for the end of each script
While queue.Count <> 0
    For i = queue.Count - 1 To 0 Step -1
        If queue(i).Status = 1 Then
            If queue(i).ExitCode <> 0 Then WScript.Echo queue(i).StdErr.ReadAll
            queue.RemoveAt i
        End If
    Next
    WScript.Sleep 200
Wend

Original comment by florentbr on 14 Apr 2014 at 12:54

GoogleCodeExporter commented 9 years ago

Original comment by florentbr on 8 Sep 2014 at 5:40