Jump to content

Recommended Posts

Posted

I've been using AutoIt to automate browser-related things for several years.  Starting this morning, my scripts started failing, and I can't seem to figure it out.  I found a very basic script that experiences the same problem.  It looks like this:

; source from https://www.autoitscript.com/forum/topic/202981-new-to-this-need-help-webdriver-udf-chrome/page/3/

#include "wd_core.au3"
$_WD_DEBUG = $_WD_DEBUG_Info        ; Full logging to console

Local $sDesiredCapabilities, $sSession
SetupChrome()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}'
EndFunc

I made sure I have the current chromedriver (chromedriver_win32 (94.0.4606.61)) that and it is in the right directory (C:\Program Files\Google\Chrome\Application), and the Scite console looks like this:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\idea2.au3"    
_WD_Startup: OS:    WIN_10 WIN32_NT 19043 
_WD_Startup: AutoIt:    3.3.14.5
_WD_Startup: WD.au3:    0.4.1.1
_WD_Startup: WinHTTP:    1.6.4.2
_WD_Startup: Driver:    chromedriver.exe
_WD_Startup: Params:    --log-path="C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\chrome.log"
_WD_Startup: Port:    9515
_WD_Startup ==> General Error: Error launching web driver!
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
>Exit code: 0    Time: 2.472

I don't know where to start to diagnose and fix this.  Can someone help point out where my problem might be?

Thanks...

Geoff

Posted (edited)
  On 9/30/2021 at 5:06 PM, geoffnoakes said:

_WD_Startup: Port:    9515
_WD_Startup ==> General Error: Error launching web driver!

Expand  

Did you try on few computers ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/30/2021 at 5:06 PM, geoffnoakes said:

I made sure I have the current chromedriver (chromedriver_win32 (94.0.4606.61)) that and it is in the right directory (C:\Program Files\Google\Chrome\Application)

Expand  

What version of Chrome? Also, what makes that the correct directory? If you are going to place it there, then you likely need to adjust to following line to include the full path --

_WD_Option('Driver', 'chromedriver.exe')

 

Posted

Danp, sorry to take so long -- my daughter's wedding was Saturday.

I am using Chrome "Version 94.0.4606.71 (Official Build) (64-bit)".

I have used the folder "C:\Program Files\Google\Chrome\Application\" for years; I cannot say for sure why, but I think at the time I wanted "all the Chrome stuff to be in one place".  

I made only 1 change to the source (the line with "modified 20211004"):

; source from https://www.autoitscript.com/forum/topic/202981-new-to-this-need-help-webdriver-udf-chrome/page/3/

#include "wd_core.au3"
$_WD_DEBUG = $_WD_DEBUG_Info        ; Full logging to console

Local $sDesiredCapabilities, $sSession
SetupChrome()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

Func SetupChrome()
    ; _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Driver', 'C:\Program Files\Google\Chrome\Application\chromedriver.exe') ; modified 20211004
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}'
EndFunc

... and the console reports the same problem:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\idea3.au3"    
_WD_Startup: OS:    WIN_10 WIN32_NT 19043 
_WD_Startup: AutoIt:    3.3.14.5
_WD_Startup: WD.au3:    0.4.1.1
_WD_Startup: WinHTTP:    1.6.4.2
_WD_Startup: Driver:    C:\Program Files\Google\Chrome\Application\chromedriver.exe
_WD_Startup: Params:    --log-path="C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\chrome.log"
_WD_Startup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
>Exit code: 0    Time: 2.683

Thanks...

Geoff

 

Posted
  On 10/4/2021 at 7:34 PM, geoffnoakes said:

... and the console reports the same problem:

Expand  

Technically, that statement is inaccurate. It appears that chromedriver was found and launched, but your attempt to create a session failed. Can you post the contents of C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\chrome.log?

I seem to recall reading where recent versions of Chrome / Chromedriver were problematic for some people.

Posted

I ran the same code as before:

; source from https://www.autoitscript.com/forum/topic/202981-new-to-this-need-help-webdriver-udf-chrome/page/3/

#include "wd_core.au3"
$_WD_DEBUG = $_WD_DEBUG_Info        ; Full logging to console

Local $sDesiredCapabilities, $sSession
SetupChrome()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

Func SetupChrome()
    ; _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Driver', 'C:\Program Files\Google\Chrome\Application\chromedriver.exe') ; modified 20211004
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}'
EndFunc

The console results:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\idea3.au3"    
_WD_Startup: OS:    WIN_10 WIN32_NT 19043 
_WD_Startup: AutoIt:    3.3.14.5
_WD_Startup: WD.au3:    0.4.1.1
_WD_Startup: WinHTTP:    1.6.4.2
_WD_Startup: Driver:    C:\Program Files\Google\Chrome\Application\chromedriver.exe
_WD_Startup: Params:    --log-path="C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\chrome.log"
_WD_Startup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
>Exit code: 0    Time: 4.353
 

... and no chrome log file ("chrome.log") was created, either in the directory I would have exepected (@ScriptDir & '\chrome.log"') or anywhere else on my PC (I did a search of "C:" -- no log file at all.

Thanks...

Geoff

Posted

Hmm, some new behavior to report...

I ran the same source (no ,modifications at all.  I turned off Microsoft Defender (the only AV I am using).  The script ran to its end, and the console log reported:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\idea3.au3"    
_WD_Startup: OS:    WIN_10 WIN32_NT 19043 
_WD_Startup: AutoIt:    3.3.14.5
_WD_Startup: WD.au3:    0.4.1.1
_WD_Startup: WinHTTP:    1.6.4.2
_WD_Startup: Driver:    C:\Program Files\Google\Chrome\Application\chromedriver.exe
_WD_Startup: Params:    --log-path="C:\Users\geoffrey_noakes\Documents\MySystem\Source\MyChromeLib\chrome.log"
_WD_Startup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"94.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"94.0.4606.71","chrome":{"chromedriverVersion":"94.0.4606.61 (418b78f5838ed0b1c69bb4e51ea0252171854915-refs/branch-heads/4606@{#1204})","userDataDir":"C:\\Users\\GEOFFR~1\\AppData\\Local\\Temp\\scoped_dir10392_905620874"},"goog:chromeOptions":{"debuggerAddress":"localhost:51148"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"30c565ec29d573ee40b1f3b8443191ed"}}
>Exit code: 0    Time: 1.875
 

,,, BUT... a CMD window appeared and did not go away.  I have attached a screenshot of it (could not find a way to scrape it).

Does that help?

Thanks...

Geoff

 

Screenshot-20211006-1030am.png

Posted
  On 10/6/2021 at 5:31 PM, geoffnoakes said:

Does that help?

Expand  

Yes, that's the console window for  Chromedriver. There are ways to hide it, but I wouldn't until you've debugged your script.

So the script ran successfully. You will likely need to add an exception to MS Defender so that your script will be able to run with it still enabled. Maybe you can find a log that indicates what was being blocked and why.

Posted

Danp2, I turned Microsoft Defender off temporarily, ran my script, and it ran to completion successfully (and there was no CMD window), and then I turned Defender back on.  So I think I have a solution and I thank you for your help and guidance on this.

Thanks...

Geoff

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...