Jump to content

chrome automation with autoit


Recommended Posts

Hi 

I am trying to use the UDF under 

 and i was just testing with wd_demo script but on trying the demo navigation, the chrome browser launches but it then crashes without navigating and gives popup saying "chrome automation extension crashed".the chrome driver was started and was listening on the port as well and in the console, it gave GPU crashed error. I was about to post and ask under the webdriver UDF support group but it mentions that the thread is closed and so i have posted here.Anyone have faced the same issue ?

Link to comment
Share on other sites

Hi @Danp2

The error i am getting in console

_WD_IsLatestRelease: 
_WD_IsLatestRelease ==> Send / Recv error
_WDStartup: OS:    WIN_2016 WIN32_NT 14393 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.3.0.4 (Update status unknown [6])
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\divya\Desktop\chrome_autoti\WebDriver-0.3.0.4\WebDriver-0.3.0.4\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"unknown error: unable to discover open window in chrome...
_WD_CreateSession: {"value":{"error":"unknown error","message":"unknown error: unable to discover open window in chrome\n  (Session info: chrome=84.0.4147.89)","stacktrace":"Backtrace:\n\tOrdinal0 [0x011B87E3+2852835]\n\tOrdinal0 [0x010A5BB1+1727409]\n\tOrdinal0 [0x00F7E4B9+517305]\n\tOrdinal0 [0x00F6F0E7+454887]\n\tOrdinal0 [0x00F2DB06+187142]\n\tOrdinal0 [0x00F2D7FD+186365]\n\tOrdinal0 [0x00F2B70B+177931]\n\tOrdinal0 [0x00F12584+75140]\n\tOrdinal0 [0x00F13650+79440]\n\tOrdinal0 [0x00F135E9+79337]\n\tOrdinal0 [0x010BAD5C+1813852]\n\tGetHandleVerifier [0x012DC616+1075574]\n\tGetHandleVerifier [0x012DC367+1074887]\n\tGetHandleVerifier [0x012E7497+1120247]\n\tGetHandleVerifier [0x012DCC16+1077110]\n\tOrdinal0 [0x010B3206+1782278]\n\tOrdinal0 [0x010BC3BB+1819579]\n\tOrdinal0 [0x010BC523+1819939]\n\tOrdinal0 [0x010D2B45+1911621]\n\tBaseThreadInitThunk [0x746162C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77930FD9+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77930FA4+1028]\n"}}
_WD_CreateSession ==> Webdriver Exception: unknown error: unable to discover open window in chrome
  (Session info: chrome=84.0.4147.89)
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/
__WD_Delete: StatusCode=200; ResponseText={"value":null}...
_WD_DeleteSession: {"value":null}

 

I did download the latest winHTTP from the wiki https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3

 

the chromedriver version is 84.0.4147.30 and chrome browser version is 84.0.4147.89.I am trying it from windows server 2016 ...could that be the issue ?

 

attaching the chrome log.

chrome.log

Edited by Drac89
missed attachement
Link to comment
Share on other sites

2 hours ago, Drac89 said:

_WD_CreateSession ==> Webdriver Exception: unknown error: unable to discover open window in chrome

I can't recall ever experienced this error. I just tested on a Windows 2016 VM and Chrome was successfully launched and the script run successfully. Could this be some form of rights issue, where Chrome isn't able to create a required directory / file?

Have you tried running with the "no-sandbox" argument? That was the recommended solution that I found when Googling.

Link to comment
Share on other sites

thank you for testing it in your environment,Mine is also a win2016 vm server. I didnt try the sandbox option, wasnt sure how to use it. should i use it along with the below ?

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["user-data-dir=userData"] } }}}' ??

 

Link to comment
Share on other sites

Hi @Danp2

Thank you...adding that, did launch the chrome browser but the navigation is taking a long time, in console , it gives timeout but then again a prompt comes and then takes time

 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\divya\Desktop\chrome_autoti\WebDriver-0.3.0.4\WebDriver-0.3.0.4\wd_demo.au3"    
_WD_IsLatestRelease: 
_WD_IsLatestRelease ==> Send / Recv error
_WDStartup: OS:    WIN_2016 WIN32_NT 14393 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.3.0.4 (Update status unknown [6])
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\divya\Desktop\chrome_autoti\WebDriver-0.3.0.4\WebDriver-0.3.0.4\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["user-data-dir=userData", "--no-sandbox"]}}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"84.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"84.0.4147.89","chrome":{"chromedriverVersion":"84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310})","userDataDir":"userData"},"goog:chromeOptions":{"debuggerAddress":"localhost:61238"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"318fca339b594c62c92f3c5339f30d23"}}
Bypass: DemoTimeouts
+Running: DemoNavigation
__WD_Post: URL=HTTP://127.0.0.1:9515/session/318fca339b594c62c92f3c5339f30d23/url; $sData={"url":"http://google.com"}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_Navigate: WinHTTP request timed out before Webdriver
_WD_Navigate ==> Send / Recv error: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:9515/session/318fca339b594c62c92f3c5339f30d23/window/handles

 

Also, i read through the wiki , the winhttp constant au3 , i didnt add that initially, so had done that as well.

is there a way to hide the cli prompts that opens up ? and also it says "chrome is being controlled by automated test software" , is it possible to hide that ?

Edited by Drac89
Link to comment
Share on other sites

oh that error doesnt come up now, i had updated the above log,I think there was an instance of chrome already running in the user profile, 

 

is there a way to hide the cli prompts that opens up ? and also it says "chrome is being controlled by automated test software" , is it possible to hide that ?

 

I created the below simple script now,

 

#include "wd_core.au3"
#include "wd_helper.au3"
Local $sDesiredCapabilities, $sSession

  google()


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":["user-data-dir=userData", "--no-sandbox"]}}}}'
 EndFunc   ;==>SetupChrome

;Func _ChromeSetInputValueById($sSession,$Id,$Value)
 ;$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']")
 ;_WD_ElementAction($sSession,$sButton,'value', $Value)
;EndFunc

Func google()
SetupChrome()

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://172.16.22.224:8443/")


_WD_Shutdown()
EndFunc
 

 

So the above launches but the navigation to the url takes some time ,

while waiting for it to navigate, in console, it is at 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/ff347ff8afa85aee5fee7211b5596176/url; $sData={"url":"https://172.16.22.224:8443/"}

 

i believe the response for the above is taking time.

 

For this, i was just testing the launch of the application and navigation to url.and have commented the passing of credentials etc.

In logs now, it doesn't show error.

 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\divya\Desktop\chrome_autoti\WebDriver-0.3.0.4\WebDriver-0.3.0.4\wd_do1.au3"    
_WD_IsLatestRelease: 
_WD_IsLatestRelease ==> Send / Recv error
_WDStartup: OS:    WIN_2016 WIN32_NT 14393 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.3.0.4 (Update status unknown [6])
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\divya\Desktop\chrome_autoti\WebDriver-0.3.0.4\WebDriver-0.3.0.4\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["user-data-dir=userData", "--no-sandbox"]}}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"84.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"84.0.4147.89","chrome":{"chromedriverVersion":"84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310})","userDataDir":"userData"},"goog:chromeOptions":{"debuggerAddress":"localhost:61568"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"ff347ff8afa85aee5fee7211b5596176"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/ff347ff8afa85aee5fee7211b5596176/url; $sData={"url":"https://172.16.22.224:8443/"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Navigate: {"value":null}
>Exit code: 0    Time: 26.5

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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