How to update Chromedriver in Windows 7 for using selenium in VBA - vba

After I updated my chrome I got the "SessionNotCreatedError" error due to outdated Chromedriver. (My Current Chrome version is 95 and my Chromedriver is 92.xx)
Private Sub CommandButton1_Click()
Dim Driver As New WebDriver
Driver.Start "Chrome", "www.google.com" '(Line which drops an error)
end sub
I have searched for how to update chromedriver on Windows 7 and tested these methods but non of them worked:
1-I have downloaded the appropriate Chromiumdriver version which matches with my current Chrome version (which is 95) and copied it in "C:" path.
2-I have installed Chromedriver by "npm install -g chromedriver" command in CMD
3-I have added new "chromedriver.exe" path to the windows system PATH variable.

The video that I told you in the comment above explains everything you need to update your chromedriver.exe. When your Chrome version gets update again, you' ll have to get the new chromedriver.exe to match Chrome.

Related

Automation error when attempting to run Selenium chromedriver.exe in VBA from Excel 2007

It appears to me that my VBA Excel code cannot find Selenium's chromedriver.exe. Everyone says that you need MS .Net framework 3.5 and I need to update the PATH to the folder where chromedriver is located. I have done both of these things multiple times and rebooted multiple times.
I have the Selenium Type Library selected in Tools-References.
Everything worked fine before upgrading to Windows 11. I think something broke with the upgrade. Now it is Run-time error '-2146232576...' Automation error.
Sub runChrome()
Dim driver As New ChromeDriver
'Shell "wscript junk/startchrome.vbs", vbNormalFocus 'This works.
driver.Start "Chrome" 'crashes here with automation error
driver.get "www.google.com"
End Sub
The shell line in the VBA code works. It starts the chrome browser. The startchrome.vbs script comes with the Selenium code and indicates to me that Selenium is working. It just seems to be an issue with Excel 2007 not finding it.
The contents of the script (which works) are:
Set driver = CreateObject("Selenium.ChromeDriver")
driver.Start
WScript.Echo "Click OK to quit"
driver.Quit
I am not doing any scripting, but I show the vbs script to show why I believe the Selenium installation is working and can run Chrome successfully. Problem seems to be VBA from Excel.
This also works...making me think that the PATH is set correctly to find chromedriver.exe:
Sub test3()
Dim driver As New ChromeDriver
Shell "chromedriver.exe", vbNormalFocus 'This works successfully.
End Sub

Could not open connection: The path to the driver executable must be set

I had used selenium2 ave behat but I find this problem
enter image description here
I downloaded the application geckodriver since link which exists in problem in i puts the in C:/selnium and I put this path to the environments path but the problem remains .
version of mozilla firefox is 52.0.1 and version of geckodriver is v0.15.0
help me please and thank you

Chrome Driver Error using Selenium: Unable to Discover Open Pages

I'm getting a Chrome Driver related error when running my Selenium tests. The error message is "Unable to Discover Open Pages." The Selenium tests were all running fine until last evening. The problem seemed to begin after a reboot of the server the day before. I cannot reproduce this error on my local box. Running the Selenium tests from the command line on the server does open the Chrome Browser but results in the same error. Any ideas?
Line that is failing:
chromeDriver = new OpenQA.Selenium.Chrome.ChromeDriver(externalDriverPath);
Error message and stacktrace:
unable to discover open pages (Driver info:
chromedriver=2.1,platform=Windows NT 6.1 SP1 x86_64) at
OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response
errorResponse) at
OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String
driverCommandToExecute, Dictionary`2 parameters) at
OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities
desiredCapabilities) at
OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor
commandExecutor, ICapabilities desiredCapabilities) at
OpenQA.Selenium.Chrome.ChromeDriver..ctor(String
chromeDriverDirectory, ChromeOptions options) at
OpenQA.Selenium.Chrome.ChromeDriver..ctor(String
chromeDriverDirectory) at SeleniumTests.BaseTest.SetupBrowsers()
When creating an instance of the ChromeDriver, a console window appears. The server with the error seems to refer to things NOT IMPLEMENTED.
ChomeDriver Output From the Server with the Error:
Started ChromeDriver (v2.1) on port 2984
[4700:4292:0108/111503:ERROR:gpu_info_collector_win.cc(102)] Can't
retrieve a va lid WinSAT assessment.
[4700:4292:0108/111503:ERROR:chrome_views_delegate.cc(176)] NOT
IMPLEMENTED
[4700:4292:0108/111503:ERROR:desktop_root_window_host_win.cc(746)] NOT
IMPLEMENT ED [0108/111504:ERROR:gl_surface_egl.cc(132)] eglInitialize
failed with error UNKNO WN [0108/111504:ERROR:gl_surface_win.cc(97)]
GLSurfaceEGL::InitializeOneOff failed.
ChomeDriver Output From My PC which works fine:
Started ChromeDriver (v2.1) on port 18786
[884540:883760:0108/114010:ERROR:gpu_info_collector_win.cc(102)] Can't
retrieve a valid WinSAT assessment.
[884992:884996:0108/114010:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches.
[885232:885236:0108/114011:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches.
[884540:883760:0108/114011:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches. [0108/114011:ERROR:gl_surface_egl.cc(131)] eglInitialize
failed with error UNKNO WN [0108/114011:ERROR:gl_surface_win.cc(54)]
GLSurfaceEGL::InitializeOneOff failed.
You are using a highly outdated version of the ChromeDriver. Your first port of call should be to update it here.
I would highly suspect the problem is your Chrome on your server has updated, and ChromeDriver v2.1 doesn't support any recent versions of Chrome.
Look here for other possible solutions: https://groups.google.com/forum/?hl=en#!topic/selenium-users/gfvfH-YEC48
In my case, adding the --no-sandbox argument to ChromeOptions solved the problem.
Here's a quick workaround I found while digging around to get rid of that error: unknown error: unable to discover open pages
In your protractor config file, add the following:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--no-sandbox']
}
},
The most important line there is the --no-sandbox; adding that line somehow gets rid of that error.
I am not exactly sure why it works but it's a workaround I found while digging around online.
***********************************UPDATES as of 10/04/2016***********************************
Please ignore this part right above as that workaround is NOT a proper fix; below I show you the actual fix to your problem; you just have an outdated chrome driver and running "webdriver-manager update" will only update up to v2.22 so I'll show you how to grab v2.24 right below.
Read on if your webdriver-manager update doesn't update chromedriver
to the latest i.e past v2.22 OR to v2.24 as of 10/04/2016.
I lost a few weeks pulling my hair around an issue I had with "Unable to discover open pages" and every time I would update the chromedriver, it would update to version 2.22 for chromedriver and I believe the selenium server to v2.53.
My problem wasn't really with the selenium server so v2.53 was fine.
Issue was with chromedriver v2.22.
Eventhough this chromdriver link showed that there was a latest version of 2.24, 'webdriver-manager update' would NOT pick up that latest version, it would only grab version 2.22 of the chrome driver.
How did I go around this?
Simply run the command below after you check this link for which version of chromedriver you want to update to; for instance, I wanted v2.24 so I ran the command below:
webdriver-manager update --versions.chrome 2.24
If you check your location: C:\Users\<USER>\AppData\Roaming\npm\node_modules\webdriver-manager\selenium\
You should see that the desired chromedriver was downloaded there; if it's not there, read the command prompt logs and it'll tell you where it downloaded your chromdriver files.
Hope that helps someone!
I had the same problem, but updating to the latest ChromeDriver (v2.8) did not solve it for me. I was running Selenium on a CI server (A Dell machine running 64 bit Win 7). I got the exception every time when the server had been 'idle' for a while.
What fixed the problem for me was to set 'Turn off display after' in Windows' Power Options to 'Never'.
I am running selenium with python in Docker on a Google compute instance. For me, the issue was that my instance didn't have enough memory, and my scrape job would fail with this error. Upgrading it to g1-small resolved the issue for me.
In my case the problem was due to one of my colleagues, who started his tests at the same time on the same server, so that my web driver could not access the Chrome executable. It also happens if someone didn't finish his web driver process properly, in this case you have to kill it manually.
First make sure you have updated you chrome browser, through the Menu UI.
Then update ChromeDriver, here.
For some reason the Chrome driver cannot interpret https traffic. If you change your link to http it will work nicely.

Running selenium tests from Jenkins - cannot find firefox

I have some selenium tests written in java and built using maven. The pom file includes the jbehave and selenium libraries. It uses firefox browser. So I installed firefox on linux and included the path in my .bashrc. If I do a mvn clean install manually , it works fine.
But if I try the same thing using Jenkins ( am trying to automate the tests), it is throwing errors:
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Caused by: org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
I tried doing an echo of PATH within Jenkins and it did not show the path of firefox. So I also did an export PATH with the new path of firefox included and then called mvn clean install in Jenkins. Even though the PATH now showed the path of firefox in jenkins console output, it still throws the same error.
What is that I am missing?
Three things to check:
1) as #shawnzhu said, check whether you have installed firefox properly?
2) To provide Binary path to your driver, you need to set system property. Use below code for selenium with java:
File firefoxPathBinary = new File("path/to/your//firefox-bin");
System.setProperty("webdriver.firefox.bin", firefoxPathBinary.getAbsolutePath());
driver = new FirefoxDriver();
3) For Ubuntu, path to your firefox executable could be - usr/lib/firefox/firefox-bin and for Mac it could be /Applications/Firefox.app/Contents/MacOS/firefox-bin
You probably need to link the executable:
sudo unlink /usr/bin/firefoxsudo ln -s /path/to/new/firefox/executable /usr/bin/firefox

Selenium node failing to run IE or Chrome web drivers

Here's simple batch file I wrote to start the node for selenium grid
set webdriver.ie.driver=C:\selenium-server\IEDriverServer.exe
echo %webdriver.ie.driver%
set webdriver.chrome.driver=C:\selenium-server\chromedriver.exe
echo %webdriver.chrome.driver%
java -jar selenium-server-standalone-2.32.0.jar -role hub
Yes both drivers exist in that directory and I've even added that directory to my System's Path variable. When I try to create a remote web driver like thus:
Platform platform = Platform.WINDOWS;
desiredCapabilities =new DesiredCapabilities("internet explorer", "9.0", platform);
driver = new RemoteWebDriver(new URL(gridUrl), desiredCapabilities);
I'm still getting an exception stating:
Exception: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see htt
/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://code.google.com/p/selenium/downloads/list
I'm using the latest IEDriver and chromedriver and selenium server 2.32.0 (which I believe is the latest one too).
Running on windows 7. I've tried both the 32 and 64 bit drivers for IE. Get the same problem with the chrome driver.
Adding this option at the end of the command to start my node got everything working. Is this just poorly documented? did I miss something obvious? or is there still something weird going on?
-Dwebdriver.ie.driver=C:\selenium-server\IEDriverServer.exe