I am learning Selenium VBA. I want to use HideCommandPromptwindow in Selenium VBA.
The code bellow returns runtime-error 438 error.
HideCommandPromptWindow example:
Attached print-screen source: https://github.com/danwagnerco/selenium-vba/issues/68.
My code:
Sub abc()
Dim driver As New SeleniumWrapper.WebDriver
driver.HideCommandPromptWindow = True
driver.Start "chrome", "https://www.google.com"
driver.Quit
driver.Close
End Sub
Error:
For driver.HideCommandPromptWindow = TrueI'm prompted with runtime error 438 object doesn't support this property or method.
How can I use it? Have a nice day!
The .HideCommandPromptWindow property was available from version 1.0.18
You are getting that error because you are using an old version of the wrapper. My guess is that you are using version 1.0.17.
Please download the latest version from the below link and try again. I tried with version 1.0.17 and I got the error but when I installed the version 1.0.18, it worked just fine as shown in the screenshot below.
Selenium Wrapper Setup File
Solution copied from origin:
selenium vba runtime-error 438
Related
Please help me to solve this problem, i have tried many ways since one month ago, but i always failed.
I use Windows 7, Service Pack 1, 64 bit - Microsoft Excel professionl plus 2019.
My Current Chrome version is 94.0.46, I have tried other versions as well.
I use Chromedrive version 94.0.4606 but also have tried 93 and 92 versions.
I have tried different versions of SeleniumBasic, from 2.0.2.0 to 2.0.9.0 .
Also Google Chrome is not running as an administrator.
What i do always is: I uninstll Selenium, install it again or its another versaion, download the same chromedrive version that my google chrome uses, copy the chromedrive into the Selenium folder, either in "program files" path or "users" path and start it. Also "selenium Type Library" is selected in VBA References.
I run a very simple code:
Sub TestSelenium()
Dim Mybrowser As Selenium.ChromeDriver
Set Mybrowser = New Selenium.ChromeDriver
Mybrowser.Start
End Sub
I always get same error:
Define Mybrowser as webdriver. Please try below code.
Sub TestSelenium()
Dim Mybrowser As new webdriver
Mybrowser.start "chrome"
Mybrowser.get "https://google.com"
Application.Wait Now+Timevalue("00:00:20")
End Sub
Code is working well but after running several times it stuck with Run-time error '21'.
It cannot open webdriver with run-time error '21': as attached picture.
'bot. start "Chrome" which is the code that has the error.
Chrome version: 83.0.4103.97
Selenium: SeleniumBasic-2.0.9.0
enter image description here
Dim bot As New WebDriver
Dim ele As WebElement
Dim picEle As WebElement
Dim awbaLI As WebElements
Dim AWB As List
bot.Start "Chrome"
bot.Get "https://google.com"
The error message says that you Port (62982, according to your provided screenshot) is still in use and thus cannot be reused.
You must also close to bot instance in order to release the port again (this also explains why it works again when you restart your PC (because then all the ports are released automatically)
In this case this can be done by calling bot.Quit at the very end of your bot usage / script!
I've got an issue with a piece of VBA code that runs fine on a windows 7 machine, but doesn't work on windows 10. My VBA skills aren't good enough to figure this one out.
This part of the code in run in a Excel class and is used to load a xml file and return the xml as a class.
Public Function GetDomNodeList(ByRef log As Logger) As MSXML2.IXMLDOMNodeList
Dim domdocument As New MSXML2.DOMDocument60
'Open file for handling
domdocument.async = False
domdocument.Load (strThisFilePath)
'Call the helper sub to do the actual work:
Set GetDomNodeList = domdocument.childNodes
End Function
When debugging it tells me there is a type mismatch. I've tried to debug the issue, but I'm running short on knowledge here. My main question is why this works on windows 7 and why not on windows 10 running the same office version (2016) VBA7.1
After a lot of trials I found a solution. Export the class, remove it and import the class again and all magically works again. I'm baffled by this.
As a follow-up to a previous post about my VBA/Rhinoscript, I'm running to a really weird "catastrophic" error when I execute the following VBA code from an Excel spreadsheet originally created in Excel 2007 that I'm now trying to run in Excel 2016:
Set Rhino = CreateObject("Rhino4.Interface")
If (Err.Number <> 0) Then
'MsgBox ("Failed to create Rhino4 object")
Set Rhino = CreateObject("Rhino4.Application")
If (Err.Number <> 0) Then
MsgBox "Failed to create Rhino4 object: " & Err.Number
Exit Sub
End If
End If
The CreateObject failing with a Run-time error 8000fff Automation error, Catastrophic failure. Checking around, people have made vague mentions of about migrating between Excel versions being a problem and to look under Tools->References, but I'm not sure exactly what I should be looking for. Does anyone know?
Thanks,
Matt
I am able to make your code work here with Excel 2010 and Rhino 4.0 SR9.
If you are not running Rhino 4.0 SR9, then I suggest you download and install this service release:
http://www.rhino3d.com/download/rhino/4.0/sr
My guess is that Rhino's COM components are not property registered (in the Windows Registry). Installing the latest service release should fix this.
Let me now if this helps.
-- Dale
We have this simple piece Where in we are registering an Addin and trying to find the Addin by looping through the list of Addins. This is not consistently reproducible on all the machines and we started seeing this on a client machine. We don't see anything wrong with the code either. We didn't see much on any of the forums. Please help.
When the code hits the for loop we get this error. Runtime Error -2147310770(8002801d). method 'comaddins' of object '_application' failed.
For Each oAddin In oWordApp.COMAddIns
Sub Main()
Call RegisterAddin
Dim oWordApp As New Word.Application
Dim oAddin As Office.COMAddIn
**For Each oAddin In oWordApp.COMAddIns**
If oAddin.DESCRIPTION = "TestingCom Addin" Then
oAddin.Connect = True
End If
Next
Try casting another Microsoft.Office.Interop.Word._Application variable to Word.Application, then use Microsoft.Office.Core.COMAddIn to get items in the _Application.COMAddIns collection.
I was able to fix this using the below link. Looks like the previous/latest version of Office was not uninstalled properly and was causing problems with Office 2007.
http://kb.palisade.com/index.php?pg=kb.page&id=528