Jump to content

Recommended Posts

Posted (edited)
  On 4/13/2023 at 10:23 PM, Erik_NJ said:
_WD_Startup: WinHTTP:   1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)
Expand  

Please grab the source from the link provided and replace your existing WinHttp.au3

  Quote
__WD_Post ==> Webdriver Exception [10] : HTTP status = 500
_WD_CreateSession ==> Webdriver Exception [10]
Expand  

You can get more detailed logging if you use $_WD_DEBUG = $_WD_DEBUG_Full so that we don't have to slog through 2MB of logs.

Also, since the session creation step failed there's no point in continuing to run the script beyond that point. You should as this line after the call to _WD_CreateSession --

If @error Then Exit

 

Edited by Danp2
Posted

Hi,

I do have this line in my code:

If @error Then Exit SetError(1, @error)

Yes, I have the latest WinHTTP (in fact, I ran the script with 1.6.4.1 and 1.6.4.2 which is currently installed)

I've changed the DEBUG var as you suggested, this is the Scite Log

>"D:\Development\AutoIT_v33161\SciTe\..\AutoIt3.exe" "D:\Development\AutoIT_v33161\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.au3" /test /run /prod /ErrorStdOut /in "D:\Development\AutoIT_v33161\_AutoIT-Apps\DEMO\WebTest.au3" /UserParams    
+>18:46:42 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0)  Keyboard:00000409  OS:WIN_10/2009  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => D:\Development\AutoIT_v33161\SciTe   UserDir => D:\Development\AutoIT_v33161\SciTe\AutoIt3Wrapper
- *** Compile in Test mode skipping Tidy; Au3Stripper; Resource updating and Versioning to speed up the process. ***
>Running AU3Check (3.3.16.1)  from:D:\Development\AutoIT_v33161  input:D:\Development\AutoIT_v33161\_AutoIT-Apps\DEMO\WebTest.au3
+>18:46:42 AU3Check ended.rc:0
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
->18:46:42 Script requires Admin rights while SciTE is at normal level -> Starting new AutoIt3Wrapper with #RequireAdmin to run the script.
+>18:46:44 Script started, waiting for output. (pid=9172)
-##>18:46:44 Restarted AutoIt3Wrapper with #RequireAdmin. (pid=9172)
- *** Compile in Test mode skipping Tidy; Au3Stripper; Resource updating and Versioning to speed up the process. ***
>Running:(3.3.16.1):D:\Development\AutoIT_v33161\autoit3_x64.exe "D:\Development\AutoIT_v33161\_AutoIT-Apps\DEMO\WebTest.au3"     
_WD_Option ==> Success [0] : Parameters:   Option=Driver   Value=D:\Development\AutoIT_v33161\_UDF\WebDriver\msedgedriver.exe
_WD_Option ==> Success [0] : Parameters:   Option=Port   Value=9515
_WD_Option ==> Success [0] : Parameters:   Option=DriverParams   Value=--log-path="D:\Development\AutoIT_v33161\_AutoIT-Apps\DEMO\MSEdge.log"
_WD_CapabilitiesStartup: #148 : > {"capabilities":"{}"} > IsObj = 1
_WD_CapabilitiesAdd: #177 :      $key = alwaysMatch     $value1 = msedge     $value2 = 
_WD_CapabilitiesAdd: #205 :  $_WD_NOTATION__MATCHTYPE = [capabilities][alwaysMatch] $_WD_NOTATION__SPECIFICVENDOR = ["ms:edgeOptions"]
_WD_CapabilitiesAdd ==> Success [0] : Successfully used [alwaysMatch]  with specified browser: msedge
_WD_CapabilitiesAdd: #177 :      $key = excludeSwitches     $value1 = enable-automation     $value2 = 
_WD_CapabilitiesAdd: #239 #275 :      $key = excludeSwitches     $value1 = enable-automation     $value2 =     $s_Notation = [capabilities][alwaysMatch]["ms:edgeOptions"]["excludeSwitches"][0]   <<<<  enable-automation
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_CapabilitiesAdd: #177 :      $key = acceptInsecureCerts     $value1 = True     $value2 = 
_WD_CapabilitiesAdd: #217 #275 :      $key = acceptInsecureCerts     $value1 = True     $value2 =     $s_Notation = [capabilities][alwaysMatch]["acceptInsecureCerts"]   <<<<  True
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_CapabilitiesAdd: #177 :      $key = args     $value1 = -inprivate     $value2 = 
_WD_CapabilitiesAdd: #239 #275 :      $key = args     $value1 = -inprivate     $value2 =     $s_Notation = [capabilities][alwaysMatch]["ms:edgeOptions"]["args"][0]   <<<<  -inprivate
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_CapabilitiesAdd: #177 :      $key = args     $value1 = user-data-dir     $value2 = C:\Stash\WD_Testing_Profile
_WD_CapabilitiesAdd: #247 #275 :      $key = args     $value1 = user-data-dir     $value2 = C:\Stash\WD_Testing_Profile    $s_Notation = [capabilities][alwaysMatch]["ms:edgeOptions"]["args"][1]   <<<<  user-data-dir=C:\Stash\WD_Testing_Profile
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_GetFreePort ==> Success [0] : 9515
_WD_IsLatestRelease ==> Success [0] : True
_WD_Startup: OS:    WIN_10 WIN32_NT 19045 
_WD_Startup: AutoIt:    3.3.16.1
_WD_Startup: Webdriver UDF: 0.13.0 (Up to date)
_WD_Startup: WinHTTP:   1.6.4.2
_WD_Startup: Driver:    D:\Development\AutoIT_v33161\_UDF\WebDriver\msedgedriver.exe (64 Bit)
_WD_Startup: Params:    --log-path="D:\Development\AutoIT_v33161\_AutoIT-Apps\DEMO\MSEdge.log"
_WD_Startup: Port:  9515
_WD_Startup: Command:   "D:\Development\AutoIT_v33161\_UDF\WebDriver\msedgedriver.exe" --log-path="D:\Development\AutoIT_v33161\_AutoIT-Apps\DEMO\MSEdge.log" 
_WD_Startup ==> Success [0]
__WD_Post: URL=HTTP://127.0.0.1:9515/session; Data={
    "capabilities":{
        "alwaysMatch":{
            "acceptInsecureCerts":true,
            "ms:edgeOptions":{
                "excludeSwitches":[
                    "enable-automation"
                ],
                "args":[
                    "-inprivate",
                    "user-data-dir=C:\\Stash\\WD_Testing_Profile"
                ]
            }
        }
    }
}
__WD_Post ==> Webdriver Exception [10] : HTTP status = 500 ResponseText={"value":{"error":"unknown error","message":"unknown error: Microsoft Edge failed to start: exited normally.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from msedge location C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x00007FF6ED83D8C2+60274]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7CE522+818882]\n\t(No symbol) [0x00007FF6ED45DFAE]\n\t(No symbol) [0x00007FF6ED4894B1]\n\t(No symbol) [0x00007FF6ED48440A]\n\t(No symbol) [0x00007FF6ED4C7341]\n\t(No symbol) [0x00007FF6ED4BF343]\n\t(No symbol) [0x00007FF6ED491796]\n\t(No symbol) [0x00007FF6ED490975]\n\t(No symbol) [0x00007FF6ED491F04]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED6D2147+1592039]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED57AC4D+185837]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED70F6B7+36951]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7077C5+4453]\n\tMicrosoft::Applications::Events::ILogManager::DispatchEventBroadcast [0x00007FF6EDA0FB93+1320211]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7D65DC+851836]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7D2644+835556]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7D279C+835900]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7C8371+793873]\n\tBaseThreadInitThunk [0x00007FFA52247604+20]\n\tRtlUserThreadStart [0x00007FFA532026A1+33]\n"}}
_WD_CreateSession ==> Webdriver Exception [10]
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; Data={"url":"http://www.google.com"}
__WD_Post ==> Invalid session ID [16] : HTTP status = 404 ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x00007FF6ED83D8C2+60274]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7CE522+818882]\n\t(No symbol) [0x00007FF6ED45DE16]\n\t(No symbol) [0x00007FF6ED49004D]\n\t(No symbol) [0x00007FF6ED4BF462]\n\t(No symbol) [0x00007FF6ED48F5A1]\n\t(No symbol) [0x00007FF6ED4BBA31]\n\t(No symbol) [0x00007FF6ED4BB33A]\n\t(No symbol) [0x00007FF6ED42DB20]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED6D2147+1592039]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED57AC4D+185837]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED70F6B7+36951]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7077C5+4453]\n\tMicrosoft::Applications::Events::ILogManager::DispatchEventBroadcast [0x00007FF6EDA0FB93+1320211]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7D65DC+851836]\n\t(No symbol) [0x00007FF6ED42C9D6]\n\tMicrosoft::Applications::Events::time_ticks_t::time_ticks_t [0x00007FF6EDA3F118+128456]\n\tBaseThreadInitThunk [0x00007FFA52247604+20]\n\tRtlUserThreadStart [0x00007FFA532026A1+33]\n"}}
_WD_Navigate ==> Invalid session ID [16] : Parameters:   URL=http://www.google.com
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; Data={"url":"http://www.duckduckgo.com"}
__WD_Post ==> Invalid session ID [16] : HTTP status = 404 ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x00007FF6ED83D8C2+60274]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7CE522+818882]\n\t(No symbol) [0x00007FF6ED45DE16]\n\t(No symbol) [0x00007FF6ED49004D]\n\t(No symbol) [0x00007FF6ED4BF462]\n\t(No symbol) [0x00007FF6ED48F5A1]\n\t(No symbol) [0x00007FF6ED4BBA31]\n\t(No symbol) [0x00007FF6ED4BB33A]\n\t(No symbol) [0x00007FF6ED42DB20]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED6D2147+1592039]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED57AC4D+185837]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED70F6B7+36951]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7077C5+4453]\n\tMicrosoft::Applications::Events::ILogManager::DispatchEventBroadcast [0x00007FF6EDA0FB93+1320211]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7D65DC+851836]\n\t(No symbol) [0x00007FF6ED42C9D6]\n\tMicrosoft::Applications::Events::time_ticks_t::time_ticks_t [0x00007FF6EDA3F118+128456]\n\tBaseThreadInitThunk [0x00007FFA52247604+20]\n\tRtlUserThreadStart [0x00007FFA532026A1+33]\n"}}
_WD_Navigate ==> Invalid session ID [16] : Parameters:   URL=http://www.duckduckgo.com
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; Data={"url":"http://www.bing.com"}
__WD_Post ==> Invalid session ID [16] : HTTP status = 404 ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x00007FF6ED83D8C2+60274]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7CE522+818882]\n\t(No symbol) [0x00007FF6ED45DE16]\n\t(No symbol) [0x00007FF6ED49004D]\n\t(No symbol) [0x00007FF6ED4BF462]\n\t(No symbol) [0x00007FF6ED48F5A1]\n\t(No symbol) [0x00007FF6ED4BBA31]\n\t(No symbol) [0x00007FF6ED4BB33A]\n\t(No symbol) [0x00007FF6ED42DB20]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED6D2147+1592039]\n\tMicrosoft::Applications::Events::EventProperties::SetLevel [0x00007FF6ED57AC4D+185837]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED70F6B7+36951]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7077C5+4453]\n\tMicrosoft::Applications::Events::ILogManager::DispatchEventBroadcast [0x00007FF6EDA0FB93+1320211]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty [0x00007FF6ED7D65DC+851836]\n\t(No symbol) [0x00007FF6ED42C9D6]\n\tMicrosoft::Applications::Events::time_ticks_t::time_ticks_t [0x00007FF6EDA3F118+128456]\n\tBaseThreadInitThunk [0x00007FFA52247604+20]\n\tRtlUserThreadStart [0x00007FFA532026A1+33]\n"}}
_WD_Navigate ==> Invalid session ID [16] : Parameters:   URL=http://www.bing.com
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/
__WD_Delete ==> Success [0] : HTTP status = 200 ResponseText={"value":null}
_WD_DeleteSession ==> Success [0] : WebDriver session deleted
+>18:47:04 AutoIt3.exe ended.rc:0
+>18:47:04 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 22.85

The MSEDGE.log is still BIG (2MB)

Posted
  On 4/13/2023 at 10:50 PM, Erik_NJ said:

I do have this line in my code:

Expand  

Well, it isn't working (something clearing @error?) or it's in the wrong location. Otherwise, it would exit when the session creation fails and you wouldn't see attempts to navigate.

  Quote
"unknown error: Microsoft Edge failed to start: exited normally.\n  (unknown error: DevToolsActivePort file doesn't exist)
Expand  

This is the same error as before, so it's like the file still can't be created. I just tried it using the suggested method, and it failed with the same error. It also fails when using C:\Temp\WD_Testing_Profile. I'm wondering if the profile must already exist if you use "user-data-dir". Does C:\Stash\WD_Testing_Profile point to an existing user profile?

Posted

These errors only happen when running as ADMIN, and as you can see, I even changed the location of the profile, deleted it and run the project, same deal.

The project is nothing fancy just open the browser and navigate to 3 sites (as you can see in the logs), something is missing somewhere when elevated rights are used.

I really appreciate your help, AutoIT and this UDF are great and I'm always lucky finding bugs.

Posted

I believe the issue resides with Edgedriver. I've opened an issue on their GH repo, so now we have to wait and see how they respond. I tested with Chrome, and it appears to be able to create a new profile at the location supplied in user-data-dir in both Admin and non-Admin modes. It seems like Edge has issues create a new profile in the user supplied directory. Try running your script as standard user to see if it can create the files for the user profile. Then rerun it as Admin and see if that works.

Posted
  On 4/13/2023 at 11:45 PM, Danp2 said:

I believe the issue resides with Edgedriver. I've opened an issue on their GH repo, so now we have to wait and see how they respond. I tested with Chrome, and it appears to be able to create a new profile at the location supplied in user-data-dir in both Admin and non-Admin modes. It seems like Edge has issues create a new profile in the user supplied directory. Try running your script as standard user to see if it can create the files for the user profile. Then rerun it as Admin and see if that works.

Expand  

I've done that and it fails as admin.

I agree, this is then an EdgeDriver problem, lucky me, since I need to write this app for Edge (the "official" browser at work)

Posted
  On 4/13/2023 at 11:56 PM, Danp2 said:

As a temporary workaround, you could try using Chromedriver in lieu of Edgedriver. 😉

You would need to point to the correct binary file so that Edge was launched instead of Chrome.

Expand  

Yes, I was thinking on trying that.

Thanks a lot bud.

Posted
  On 4/13/2023 at 11:28 PM, Danp2 said:

I'm wondering if the profile must already exist if you use "user-data-dir". Does C:\Stash\WD_Testing_Profile point to an existing user profile?

Expand  

I think parent dir must exist and you should have rights to write there.

I mean c:\stash must exist.

 

Btw FF require to exist entire path.

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 4/14/2023 at 12:04 AM, mLipok said:

I think parent dir must exist and you should have rights to write there.

I mean c:\stash must exist.

 

Btw FF require to exist entire path.

Expand  

The folder exists, no restrictions and if the folder doesn't exists, it gets created automatically.

Posted
  On 4/13/2023 at 11:45 PM, Danp2 said:

I've opened an issue on their GH repo, so now we have to wait and see how they respond.

Expand  

So, here's the response from MSFT --

  Quote

Edge will not launch in administrator mode. This was an explicit decision where Edge diverges from Chrome for security reasons. The test will need to run unelevated for Edge to launch successfully.

Expand  

@Erik_NJ Why won't your script work in non-elevated mode?

Posted
  On 4/14/2023 at 11:35 AM, Danp2 said:

So, here's the response from MSFT --

@Erik_NJ Why won't your script work in non-elevated mode?

Expand  

Oh well, thanks Microsoft.

The reason I need admin rights is because the app is for internal kiosks and some settings need to be manipulated on those PCs that require elevated permissions.

My company's "official" browser is Edge and that's why I'm going thru all this.

I hate "hacking" or "workarounding" since Chrome or Edge might change something and I'll end up with a ton of non-working systems, installing Chrome will not work because InfoSec in their INFINITE WISDOM will remove the app without notice since is not "approved."

I truly appreciate all the help, I've been using AutoIT for a while and I will continue using it, it's a great tool.

Thanks

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...