Prem
Prem

Reputation: 79

Issue in launching Chrome via Selenium VBA

I have tried to launch Chrome browser via Selenium VBA by using the below code. I am getting this error when executing the code "WebRequestError The underlying connection was closed: An unexpected error occurred on a receive." But IE browser is working fine.

Sub samp()
Dim drv As New Selenium.WebDriver
drv.Start "Chrome"
drv.Get "www.google.com"
End Sub

Upvotes: 2

Views: 12949

Answers (1)

Unicco
Unicco

Reputation: 2578

I fixed this by installing the latest ChromeDriver, and replacing the .exe-file with the file located in my AppData.

Requirements

Steps

  1. Download latest WebDriver from: https://sites.google.com/a/chromium.org/chromedriver/downloads
  2. Open folder C:\Users\ Username\AppData\Local\SeleniumBasic
  3. Replace chromedriver.exe with existing file

Example

Now this example code below works as intended

Sub driver()
    Dim selenium As New selenium.WebDriver

    selenium.Start "chrome", "http://google.com"
    selenium.Get "/"

End Sub

Upvotes: 5

Related Questions