SeleniumVBA icon indicating copy to clipboard operation
SeleniumVBA copied to clipboard

Inaccessible security logs

Open taqigk85 opened this issue 1 year ago • 19 comments

It seems im getting this error with SeleniumBasic and SeleniumVBA and it will not launch any browser. Ive allowed all exceptions and exclusions you can think of through google search.

taqigk85 avatar Apr 20 '25 19:04 taqigk85

Hello taqigk85 Judging from the error message, you may be using SeleniumBasic. Which code are you using to open the URL?

【SeleniumBasic】  driver.Get (url) 【SeleniumVBA】  driver.Navigateto (url)

If you are using SeleniumBasic, unfortunately we cannot solve the problem here.

hanamichi77777 avatar Apr 20 '25 23:04 hanamichi77777

I was originally using Selenium basic but now I am using SeleniumVBA and starting the code in excel VBA like this:

Dim driver As New WebDriver Dim rowc, cc, columnC As Integer Set driver = CreateObject("SeleniumVBA.WebDriver") driver.StartChrome driver.Navigateto "https://www.google.com/" Application.Wait Now + TimeValue("00:00:2")

initially i was getting the inaccessible logs error, then when i played around with the driver and set all permissions. Now I am getting automation error (typically when Net Framework 3.5 isnt installed) But I have all type libraries and net framework installed. Chromedriver and web browswer versions match as well.

Im not very good at programming but had a web scraping program running until it stopped working.

taqigk85 avatar Apr 21 '25 01:04 taqigk85

Thank you for providing the code. It seems that "Dim driver As New WebDriver" is a SeleniumBasic driver. Please try the following code.

Dim driver As SeleniumVBA.WebDriver Set driver = SeleniumVBA.New_WebDriver Dim rowc, cc, columnC As Integer driver.StartChrome driver.Navigateto "https://www.google.com/" Application.Wait Now + TimeValue("00:00:2")

hanamichi77777 avatar Apr 21 '25 02:04 hanamichi77777

First, I appreciate you helping me troubleshoot.

I am getting the same error as earlier, "Automation Error" at driver.start Chrome. When I test the sample scripts from ehe excel, those give the same error.

On Sun, Apr 20, 2025 at 10:05 PM hanamichi77777 @.***> wrote:

Thank you for providing the code. It seems that "Dim driver As New WebDriver" is a SeleniumBasic driver. Please try the following code.

Dim driver As SeleniumVBA.WebDriver Set driver = SeleniumVBA.New_WebDriver Dim rowc, cc, columnC As Integer driver.StartChrome driver.Navigateto "https://www.google.com/" Application.Wait Now + TimeValue("00:00:2")

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2817483977, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YRHVHXS76IEKO57JXD22RG5ZAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJXGQ4DGOJXG4 . You are receiving this because you authored the thread.Message ID: @.***> hanamichi77777 left a comment (GCuser99/SeleniumVBA#152) https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2817483977

Thank you for providing the code. It seems that "Dim driver As New WebDriver" is a SeleniumBasic driver. Please try the following code.

Dim driver As SeleniumVBA.WebDriver Set driver = SeleniumVBA.New_WebDriver Dim rowc, cc, columnC As Integer driver.StartChrome driver.Navigateto "https://www.google.com/" Application.Wait Now + TimeValue("00:00:2")

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2817483977, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YRHVHXS76IEKO57JXD22RG5ZAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJXGQ4DGOJXG4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Taqi Khawaja

taqigk85 avatar Apr 21 '25 02:04 taqigk85

It is difficult to find the cause. SeleniumVBA does not require the .Net Framework I think it's best to follow the steps from the beginning and try to find the cause. Please download the xlsm file again and try running the sample in standard module below. If "driver.StartEdge" works, try "driver.StartChrome"

Image

hanamichi77777 avatar Apr 21 '25 03:04 hanamichi77777

It says unspecified error at driver.startEdge

On Sun, Apr 20, 2025 at 11:03 PM hanamichi77777 @.***> wrote:

It's difficult to solve. Please download the xlms file again and try running the sample in standard module below.

default.png (view on web) https://github.com/user-attachments/assets/07c7bfd1-eaed-4ae2-90b6-f4e073e114a3

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2817535374, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YS3HCJP6F2QXV465R322RNZZAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJXGUZTKMZXGQ . You are receiving this because you authored the thread.Message ID: @.***> hanamichi77777 left a comment (GCuser99/SeleniumVBA#152) https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2817535374

It's difficult to solve. Please download the xlms file again and try running the sample in standard module below.

default.png (view on web) https://github.com/user-attachments/assets/07c7bfd1-eaed-4ae2-90b6-f4e073e114a3

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2817535374, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YS3HCJP6F2QXV465R322RNZZAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJXGUZTKMZXGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Taqi Khawaja

taqigk85 avatar Apr 21 '25 11:04 taqigk85

This is going to take some time to resolve. For reference, what is the error message?

Image

hanamichi77777 avatar Apr 21 '25 13:04 hanamichi77777

Just to check, Is "msedgedriver.exe" in your Downloads folder?

※Checking if WebDriver automatic download is working.

hanamichi77777 avatar Apr 21 '25 13:04 hanamichi77777

yes that is correct

On Mon, Apr 21, 2025 at 9:26 AM hanamichi77777 @.***> wrote:

Just to check, is "msedgedriver.exe" in your Downloads folder?

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2818407723, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YSSMWD26BYLTATTOK322TWZTAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJYGQYDONZSGM . You are receiving this because you authored the thread.Message ID: @.***> hanamichi77777 left a comment (GCuser99/SeleniumVBA#152) https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2818407723

Just to check, is "msedgedriver.exe" in your Downloads folder?

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2818407723, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YSSMWD26BYLTATTOK322TWZTAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJYGQYDONZSGM . You are receiving this because you authored the thread.Message ID: @.***>

-- Taqi Khawaja

taqigk85 avatar Apr 21 '25 20:04 taqigk85

Sorry for the basic question, but do you have Edge browser installed on your system?

GCuser99 avatar Apr 21 '25 20:04 GCuser99

No worries at all, I understand you have to start with the basics and most common issues.

Yes I do, I also verified that the version of Edge and drive are the same. Same for Chrome. It appears to me the problem is some sort of security issue. The most recent Windows Security update had some net framework updates. This is the time when everything stopped working. Happened in 3 other computers for me as well at the same exact time.

On Mon, Apr 21, 2025 at 4:13 PM Mike @.***> wrote:

Sorry for the basic question, but do you have Edge browser installed on your system?

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2819408183, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YWGOTCSKV2FLTWHK3322VGPXAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGQYDQMJYGM . You are receiving this because you authored the thread.Message ID: @.***> GCuser99 left a comment (GCuser99/SeleniumVBA#152) https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2819408183

Sorry for the basic question, but do you have Edge browser installed on your system?

— Reply to this email directly, view it on GitHub https://github.com/GCuser99/SeleniumVBA/issues/152#issuecomment-2819408183, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRGR4YWGOTCSKV2FLTWHK3322VGPXAVCNFSM6AAAAAB3QAHL72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGQYDQMJYGM . You are receiving this because you authored the thread.Message ID: @.***>

-- Taqi Khawaja

taqigk85 avatar Apr 21 '25 20:04 taqigk85

Are you using Windows 11 version 24H2? Many problems have been reported with 24H2. In that case, it may be difficult to deal with it using only SeleniumVBA.

hanamichi77777 avatar Apr 21 '25 22:04 hanamichi77777

I have Windows 11 24H2 installed on all of my machines and SeleniumVBA is working fine on all of them.

It is very possible that we are dealing with two different issues for SeleniumBasic versus SeleniumVBA.

@taqigk85, as was requested by @hanamichi77777 above, can you provide the actual error that is issued and from which line of the SeleniumVBA.xlsm code it occurs? You can take a screenshot of the error dialog with the code line that throws the error. It should then be much easier for us to debug, otherwise we are just throwing darts in the dark.

GCuser99 avatar Apr 22 '25 07:04 GCuser99

Oh, and please use one of the pre-packaged test routines to report the error.

GCuser99 avatar Apr 22 '25 07:04 GCuser99

I have Windows 11 24H2 installed on all of my machines and SeleniumVBA is working fine on all of them.

I found out that SeleniumVBA works on Windows11 24H2. Thank you for @GCuser99 .

By the way, I heard that VBScript became on-demand from 24H2. If VBScript is disabled in 24H2 ,will "test2" still work? VBScript.Regex is replaced by "vba-regex", but I am worried about whether WSH, FSO, and Dictionary will work.

hanamichi77777 avatar Apr 22 '25 10:04 hanamichi77777

I did not have to do anything when I upgraded to 24H2 to enable VBScript, but maybe it can be different for some systems. If that is the problem, then @taqigk85 should also check references are all there and none missing? VBA Editor -> Tools -> References:

Image

GCuser99 avatar Apr 22 '25 15:04 GCuser99

Sorry I have not been able to check this since I am traveling today. I will double check it all and send screenshots back.Taqi KhawajaOn Apr 22, 2025, at 11:22 AM, Mike @.> wrote: I did not have to do anything when I upgraded to 24H2 to enable VBScript, but maybe it can be different for some systems. If that is the problem, then @taqigk85 should also check references are all there and none missing? VBA Editor -> Tools -> References: references.png (view on web)—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

GCuser99 left a comment (GCuser99/SeleniumVBA#152) I did not have to do anything when I upgraded to 24H2 to enable VBScript, but maybe it can be different for some systems. If that is the problem, then @taqigk85 should also check references are all there and none missing? VBA Editor -> Tools -> References: references.png (view on web)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

taqigk85 avatar Apr 22 '25 16:04 taqigk85

Oh two more things to ask @taqigk85, are you using the SeleniumVBA.xlsm file or the DLL installation? The SeleniumVBA.xlsm file will be best for debugging because it will show us the exact line of code the error is being thrown.

The other question is what AV program is being used? I know from experience that MalwareBytes will not allow SeleniumVBA to work - it blocks any reference to VBScript, and some of our Windows API functions.

GCuser99 avatar Apr 22 '25 17:04 GCuser99

The other question is what AV program is being used? I know from experience that MalwareBytes will not allow SeleniumVBA to work - it blocks any reference to VBScript, and some of our Windows API functions.

At my workplace, the security software blocks the Windows API "UrlDownloadToFile", so I can't download WebDriver. I can download it by starting the Edge/Chrome browser and directly entering the Download URL. Therefore, I use other code that doesn't use "UrlDownloadToFile" instead.

hanamichi77777 avatar Apr 25 '25 23:04 hanamichi77777

Sorry for the late response I had been traveling:

Here are all the refernces, nothing is missing:

Image

This is the error I get:

Image

Ive normally seen this error when .net framework isnt installed but everything is there. It wont let me check SeleniumVBA reference saying it conflicts with existing module, project or object library. I am using seleniumvba.xlsm

taqigk85 avatar Apr 26 '25 15:04 taqigk85

additionally, this is what I get everytime I try to run any macro with seleniumVBA. This is all through windows defender and no additionaly anti-virus/malware program:

Image

taqigk85 avatar Apr 26 '25 15:04 taqigk85

I have added any exlcusion or allowance thrugh firewall/defender to get this to work but nothing works.

taqigk85 avatar Apr 26 '25 15:04 taqigk85

@taqigk85 - that does look like a Defender-related issue. It certainly has nothing to do directly with .Net Framework as SeleniumVBA is not dependent on that library. Also, you don't need to add SeleniumVBA to your VBA references if you are using SeleniumVBA.xlsm. Adding that reference is only important if you are using the DLL version of SeleniumVBA (installed with SeleniumVBADLLSetup.exe). But even using that solution will not solve this Attack Surface Reduction problem.

Since Excel.exe is the process being blocked, is that the application that you added the exclusion for?

I'm sure that you already researched this yourself, but just in case it helps I asked an AI engine this:

In Windows 11, using Windows Defender, how do I turn off the ASR "block all office applications from creating child processes"?

And the answer was this (above my Windows skill level!):

######################################################### You can disable the Attack Surface Reduction (ASR) rule that blocks Office applications from creating child processes through Microsoft Defender for Endpoint settings. Here’s how:

  1. Using Group Policy:

    • Open the Group Policy Editor (gpedit.msc).
    • Navigate to Computer Configuration > Administrative Templates > Windows Components > Microsoft Defender Antivirus > Microsoft Defender Exploit Guard > Attack Surface Reduction.
    • Locate "Block all Office applications from creating child processes" and set it to Disabled.
  2. Using PowerShell:

    • Open PowerShell as an administrator.
    • Run the following command:
      Set-MpPreference -AttackSurfaceReductionRules_Ids 75668C1F-73B5-4CF0-BB93-3ECF5CB7CC84 -AttackSurfaceReductionRules_Actions Disabled
      
    • This will disable the specific ASR rule.
  3. Using Microsoft Defender Security Center:

    • Go to Microsoft Defender Security Center.
    • Navigate to Attack Surface Reduction Rules.
    • Locate the rule "Block all Office applications from creating child processes" and change its mode to Audit or Disabled.

For more details, you can check Microsoft’s official documentation on ASR rules here. Let me know if you need further clarification! 🚀 #########################################################

Sorry I don't have more help for you on this one @taqigk85. Thanks for reporting and your patience answering our questions. If you figure out how to solve then please report back to us in case others run into same problem. Mike

GCuser99 avatar Apr 26 '25 18:04 GCuser99

I appreciate the help you've given thus far. I have tried all of the above and still not luck. I know its an issue with excel and defender since when I run the .vbs file it works. Ive tried this on 3 different computers (windows 10 and Windows 11) and they all have the same issue. To me it relates to a windows security update that was pushed out around april 14. I even added all the seleniumvba locations in the trust center. Everything is ran as admin,

taqigk85 avatar Apr 26 '25 18:04 taqigk85

Im going to try upgrading to Windows 11 Pro to see if that makes a difference.

taqigk85 avatar Apr 26 '25 18:04 taqigk85

going through alot of the group policy editor, ASR exclusions, and some other stuff its a deeper issue thats way out of my understanding. The VBS script working I can find a work around. Is there a service I can pay for to transfer my excel VBA code to utilize the vbscipt with input from an excel sheet to extract the info I am trying to obtain?

taqigk85 avatar Apr 26 '25 22:04 taqigk85

Is your working code in SeleniumBasic or SeleniumVBA?

I am not familiar with a service, but I'm sure you could hire a coder to do it.

If you already had working code in SeleniumVBA, then you should (in theory) be able to run in VBScript with minimal or no modification. You would have to install our DLL solution. See this discussion for more info. I have done very little testing with using SeleniumVBA in VBScript so I'm not certain how robust it works.

Another very feasible direction would be to use twinBASIC to run your web scraping app. The DLL solution was developed in twinBASIC and any SeleniumVBA code that you already have written will also work in the twinBASIC project (SeleniumVBA.twinproj found in the src directory. You'd have to install twinBASIC, and then you could develop/debug/run your code there (no Office necessary).

If your current working code is written for SeleniumBasic and you are willing to share that code with the community here, then I am sure you would receive a lot of help in converting it to SeleniumVBA.

GCuser99 avatar Apr 26 '25 22:04 GCuser99

Here is what I used for selenium basic and my converted for SeleniumVBA code for vbscript. For the most part has worked within the VBscript. The only areas im having trouble are the 2 drop down menus and data extraction. Again I am not programmer or coder just civil engineer who's picked up a few tricks

SeleniumVBA.txt

SeleniumBasic.txt

:

taqigk85 avatar Apr 27 '25 00:04 taqigk85

I have not yet tested in VBScript but I'll let you do that - let me know how it goes:

Sub get_hazard_data()
    Dim table() As Variant
    Dim address As String
    Dim i As Long
    
    Dim driver As Object
    Dim addressInput As Object
    'if using twinBASIC or Excel host:
    'Dim driver As WebDriver
    'Dim addressInput As WebElement
    
    'Initialize SeleniumVBA WebDriver
    Set driver = CreateObject("SeleniumVBA.WebDriver")
    'if using twinBASIC or Excel host:
    'Set driver = New WebDriver
    
    driver.StartChrome
    driver.OpenBrowser
    
    driver.ImplicitMaxWait = 2000
    
    'Navigate to ASCE Hazard Tool
    driver.NavigateTo "https://ascehazardtool.org/"
    
    'close the popups
    driver.QuerySelector("#welcomePopup > div.popup-header.blue.darken-3.welcome-header > span.details-popup-close-icon").Click
    driver.QuerySelector("body > div.cc-window.cc-floating.cc-type-info.cc-theme-classic.cc-bottom.cc-left.cc-color-override-688238583 > div.cc-compliance > button").Click
    
    'Prompt user for an address
    'address = InputBox("Enter the address:", "User Input")
    address = "21201, Baltimore, Maryland"
    
    'Locate the address input field and enter the address
    Set addressInput = driver.FindElementByID("geocoder_input")
    addressInput.SendKeys address
    'Search for the data
    driver.FindElementByID("locate-address").Click
    
    driver.Wait 1000

    'Select Risk Category II and Site class D
    driver.QuerySelector("#risk-level-selector").SelectByValue "2" '"1", "2", "3", "4"
    driver.QuerySelector("#site-soil-class-selector").SelectByValue "6" 'D - Stiff Soil
    
    'Select criteria
    driver.QuerySelector("label[for='Wind']").Click
    driver.QuerySelector("label[for='Seismic']").Click
    driver.QuerySelector("label[for='Ice']").Click
    driver.QuerySelector("label[for='Snow']").Click
    'driver.QuerySelector("label[for='Rain']").Click
    'driver.QuerySelector("label[for='Flood']").Click
    'driver.QuerySelector("label[for='Tsumami']").Click
    'driver.QuerySelector("label[for='Tornado']").Click
    
    'click results button
    driver.QuerySelector("#resultsButton > a").Click
    
    driver.Wait 500
    
    'Retrieve full report
    On Error GoTo High_Traffic
    driver.QuerySelector("#report > div.full-report-container.padding--small.white > a:nth-child(3)").Click
    On Error GoTo 0

    'get the full report table
    table = driver.QuerySelector("table[class='summary-table']").TableToArray
    
    For i = 1 To UBound(table, 1)
        'Debug.Print "row= " & i & " " & table(i, 1) & ": " & table(i, 2)
        WScript.Echo "row= " & i & " " & table(i, 1) & ": " & table(i, 2)
    Next i
    
    'Close browser
    driver.CloseBrowser
    driver.Shutdown
    Exit Sub
High_Traffic:
    'Debug.Print "Traffic too high - try again later"
    WScript.Echo "Traffic too high - try again later"
    driver.CloseBrowser
    driver.Shutdown
End Sub

GCuser99 avatar Apr 27 '25 12:04 GCuser99

Wow this works amazing! Its interesting that this pops up the terminal before offcially launching website. so excel doesnt block it Improves upon my code significantly. I modified this slightly to list the table in a new sheet. You have solved about 2 weeks of obsessive trouble shooting for me. Thank you!

taqigk85 avatar Apr 27 '25 20:04 taqigk85