florentbr / SeleniumBasic

A Selenium based browser automation framework for VB.Net, VBA and VBScript
BSD 3-Clause "New" or "Revised" License
430 stars 197 forks source link

Webdriver does not come out of driver.START forever (sometimes) #96

Open bipo1980 opened 8 years ago

bipo1980 commented 8 years ago

Hello Florent:

i am using seleniumbasic 2.0.9.0. my usecase is to launch multiple instances (say 5 to 10) of the firefoxdriver simultaneously. each instance is a unique object of the webdriver. problem is: In most cases driver.START works perfectly. However, in 1 or 2 cases, it gets stuck in driver.start. it never comes out of driver.start even though browser is open. question: is there an option to check the outcome of .Start so that i can reinitiate .Start?

dim oDriver
Set oDriver = CreateObject("Selenium.FirefoxDriver")
oDriver.Timeouts.Server = 240000
oDriver.Timeouts.PageLoad = 180000
wscript.echo "oDriver.Start before"
oDriver.Start
'note: it never comes out of driver.start even though browser is open
wscript.echo "oDriver.Start after"
oDriver.Get SiteUrl

Thanks, B.

florentbr commented 8 years ago

Does it get unstuck if you press the key Escape? How long does it take to display an error, and what is the message?

bipo1980 commented 8 years ago

@florentbr

No. if i press key escape, it does not result in anything. There is no error displayed. It remains without exiting driver.start indefinitely.

below is an example to help simulate the problem. there are two files file_one.vbs and file_two.vbs. file_one calls file_two.

'[1] file_one.vbs
dim objShell
Set objShell = CreateObject("WScript.Shell")
for i = 1 to 15
call objShell.Run ("%comspec% /t:17 /c title " & "Selenium | " & " cscript.exe two.vbs", 4, False)
next

'[2] file_two.vbs
dim ocls
set ocls = new mycls
ocls.run

class mycls
    dim oDriver
    public function run
        Set oDriver = CreateObject("Selenium.FirefoxDriver")
        oDriver.Timeouts.Server = 240000
        oDriver.Timeouts.PageLoad = 180000
        wscript.echo "oDriver.Start before"
        oDriver.Start
        'note: sometimes it never comes out of driver.start even though browser is open
        wscript.echo "oDriver.Start after"
        oDriver.Get "https://www.google.com/"
        '...
    end function
end class