SeleniumBasic Fails to create Chrome Process - selenium

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

Related

Run-time error '21' (VBA + Selenium+Chrome)

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!

vbscript starting a specific profile connection in ibm personal communications

I have been given the task of converting the slower Macro Express Pro coding for IBM Personal Communications over to a VBScript/VBA version. The Macro Express Pro coding opens a predetermined profile from a specific location.
This process can take up to 30 seconds. VBScript does this in about a third of the time for a default profile (TN3270.WS). However, when we try opening the specific link highlighted in the UNET.txt file, we get this as an error:
Run-time error '440': Automation error
Here is the VBScript code we are trying to use:
Sub Main()
Dim EName
Dim autECLConnList, objConnMgr
Set objConnMgr = CreateObject("Pcomm.autECLConnMgr")
objConnMgr.autECLConnList.Refresh
objConnMgr.StartConnection ("profile='C:\ProgramData\IBM\Personal Communications\UNET REWORK.ws' connname=a")
Application.Wait (Now + TimeValue("00:00:12"))
objConnMgr.autECLConnList.Refresh
EName = objConnMgr.autECLConnList(1).Name
End Sub
The error occurs on the objConnMgr.StartConnection ("profile='C:\ProgramData\IBM\Personal Communications\UNET REWORK.ws' connname=a") line. We know we have the correct path to the profile because it's we found its location:
IBM says that if the profile name contains blanks, it "must to be surrounded by single quotes":
Can anyone provide some advice on what we're doing wrong or what we're missing?
Thanks.
I found a way of doing what I need to do. I was looking too specific into starting a PCOMM session that I didn't even think of just running the .exe file and send it parameters. Here's how I did it:
Sub Main()
Dim WShell
Set WShell = CreateObject("WSCript.shell")
WShell.Run """C:\Program Files (x86)\IBM\Personal Communications\pcsws.exe"" ""C:\ProgramData\IBM\Personal Communications\UNET REWORK.WS"""
End Sub
I'm sure this is a duplicate answer to another question out there, but most of the answers are more than a few years old and outdated. This solution is current and recently tested, so it is a more reliable source.

Use Selenium Driver to load page, dismiss/dispose it and keep browser active

I am using Selenium Webdriver to load a specific feature from an application, a rich text editor (actually a custom release of CKEditor) and the code below works perfectly for that... except that I would like to release Selenium objects (and geckodriver.exe/marionnette black cmd window) since the desired page was loaded. But either .Close(), .Quit() or .Dispose() methods will wipe out the Firefox window as well...
Is there a way to dismiss Selenium Webdriver and keep Firefox running by its own?
Thank you very much
Private Sub LoadResource()
Dim FFD As New OpenQA.Selenium.Firefox.FirefoxDriver()
'Set timeout of 60 seconds for steps to complete successfully
Dim WDW As New OpenQA.Selenium.Support.UI.WebDriverWait(FFD, TimeSpan.FromSeconds(60))
'navigate to login page
FFD.Navigate.GoToUrl("https://www.myapplication.com/login")
'Wait until application loads main page (this means login was successful)
WDW.Until(Function() FFD.Url = "https://www.myapplication.com/")
'Load built-in rich text editor Rich text
FFD.Navigate.GoToUrl("https://www.myapplication.com/editor?document=1080199")
'Wait for successful loading of the editor page
WDW.Until(Function() FFD.Url = "https://www.myapplication.com/editor?document=1080199")
'That's all.
'here I'd like to release Firefox to keep running and get rid of WebDriver's objects and resources, if possible.
End Sub
This is based on Kirhgoph's comment and seems to work well:
Private Sub LoadResource()
Dim FFD As New OpenQA.Selenium.Firefox.FirefoxDriver()
Dim GDP As Process = Process.GetProcessesByName("geckodriver").Last
Dim WDW As New OpenQA.Selenium.Support.UI.WebDriverWait(FFD, TimeSpan.FromSeconds(60))
FFD.Navigate.GoToUrl("https://www.myapplication.com/login")
WDW.Until(Function() FFD.Url = "https://www.myapplication.com/")
FFD.Navigate.GoToUrl("https://my.application.com/editor?document=1080199")
WDW.Until(Function() FFD.Url = "https://www.myapplication.com/editor?document=1080199")
GDP.CloseMainWindow()
GDP.WaitForExit()
FFD.Quit()
End Sub

selenium vba runtime-error 438

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

Launching Ruby script with command line flag from VB .NET

This question might seem easy, yet there seems to be a tiny tricky moment I cannot bypass.
In a nutshell, I am launching a ruby/watir web automation script from a VB .NET app. The script can work with webdrivers for IE, FF and Chrome. In case of first two it is simple. In case of Chrome it needs to launch the .rb file with --log-path flag.
Here is my code:
Dim chromeStarter As New ProcessStartInfo(generatedScripts(i))
Dim args As String = " --log-path=" & testRunPath & "\chromedriver.log"
If isChrome = True Then
chromeStarter.Arguments = args
Process.Start(chromeStarter)
Else
Process.Start(chromeStarter)
End If
Problem: Indeed it launches the correct .rb file, yet does not take flag into account.
I tried passing both file name and flag as a single string to Process.Start and it didn't work as well.
Flag works fine when script is manually run from cmd.
Thanks in advance for your advice!