OpenQASeleniumWebDriver fails to start socket at 45000ms - c#

I am new to Selenium and Web Driver and I have come across the following when using FireFox:
"OpenQA.Selenim.WebDriver Exception: Failed to start up socket within 45000ms. Attempted to connect to address 127.0.0.1.7055"
My Selenium Driver is version 2.53.1.0 and Firefox version is 48.0.1
I am only trying to open a page and type the google url just to make sure that my code works in Visual Studio 2015.
Any help would be much appreciated.
Thanks,
Tasos

I would like to write a few more details about the solution in case another stack overflow user comes across the same issue. The following steps worked for me:
1.Followed the link that Saurabh mentioned & downloaded the geckodriver exe file from https://github.com/mozilla/geckodriver/releases
2.Renamed the file from 'geckodriver' to 'wires'
3.Put the file at the Bin > Debug folder of my Visual Studio Unit Test project
4.Added the following lines of code in the cs file of my project:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = #"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
driver = new FirefoxDriver(service);

Related

The file ChromeDriver does not exist when running on Docker

I'm trying to run Selenium on Docker using Azure Function in C#. I've installed Selenium.WebDriver and Selenium.WebDriver.ChromeDriver nuget packages. In docker file I've also put code for installing Chrome driver, but when I try to create ChromeDriver in code, I get exception that chromedriver can't be found.
When I list all files in directory, I can see that there is chromedriver.exe file listed:
but when I try to create a new Chrome driver using this line:
IWebDriver driver = new ChromeDriver(Environment.CurrentDirectory);
I get the following exception:
The file /home/site/wwwroot/bin/Debug/netcoreapp3.1/chromedriver does
not exist. The driver can be downloaded at
http://chromedriver.storage.googleapis.com/index.html.
Why chromedriver.exe file is not recognized? When I run the same code without Docker, everything works fine.
Add the absolute path of chromedriver.exe to container PATH environment variable
Typically Windows executables end with .exe while Linux executables have no file extension. A file being executable on Linux is a consequence of file permissions rather than some naming convention.
The file path in the exception message uses forward-slashes / as file path delimiters rather than back slashes \ leading me to believe you have downloaded a Windows-compatible ChromeDriver which you are attempting to run on a Linux machine.
Solution: download the Linux driver instead when deployed via Docker.

How do i get selenuim to stop showing this error message?

I was trying to do a simple tester script because I wanted to get into it, but when I ran my first script, this happened. I tried installing gecko, but I have no idea how to install it, and all the tutorials didn't work for me. Any help would be much appreciated!
Using visual studio and c#
If you want to open firefox driver you need to set gecko driver by path.
//Give the path of the geckodriver.exe
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(#"C:\Users\abcd\Downloads\geckodriver-v0.13.0-win64","geckodriver.exe")
//Give the path of the Firefox Browser
service.FirefoxBinaryPath = #"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
IWebDriver driver = new FirefoxDriver(service);
driver.Navigate().GoToUrl("https://www.google.com");
new release https://github.com/mozilla/geckodriver/releases

Selenium 2.53.1 does not work on FireFox 48

I am using selenium to test our websites. When I build the project, there is an Exception :-
OpenQA.Selenium.WebDriverException: Failed to start up
socket within 45000 milliseconds. Attempted to connect to the
following addresses: 127.0.0.1:7055 and the problem is from the code
IWebDriver driver = new FirefoxDriver();
Anybody knows how to solve this problem?
Just like the other drivers available to Selenium from other browser vendors, Mozilla has released an executable that will run alongside the browser.
You can download the latest executable geckodriver from here
Add downloaded executable geckodriver to system path
The Selenium client bindings will try to locate the geckodriver (or wires) executable from the system path. You will need to add the directory containing the executable to the system path.
On Unix systems you can do the following to append it to your system’s search path, if you’re using a bash-compatible shell:
export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step
On Windows you need to update the Path system variable to add the full directory path to the executable geckodriver. The principle is the same as on Unix.
After all above stuff you need to Initialize FireFoxDriver as below :-
var driver = new FirefoxDriver(new FirefoxOptions());
Note :- Follow this link for the solution of this problem with other programming language.
This answer didn't worked with me. Running selenium 2.53.6 and firefox 47 n 48.
I would recommend downloading firefox 46 which seems to be the best match for selenium 2.53.x.
https://ftp.mozilla.org/pub/firefox/releases/46.0.1/win64/en-US/
Once I downgraded to firefox 46.0.1 everything was working as expected.

Could not find default Chrome binary

I am using the chrome webdriver for a project which works well when I run it on my local pc, however when I uploaded the project to my remote server for it to run live, the chromedriver could not load:
this is how I am calling my chromedriver:
IWebDriver driver = new ChromeDriver(#"C:\Users\User\Downloads\chromedriver_win_26.0.1383.0");
this is the error I get:
Could not find default Chrome binary
I have made sure that:
the chromedriver.exe actually is in the specified location on the server
I upload the dlls needed for it to run
Any ideas please as to why this is happening?
The WebDriver part is fine, but I found that the problem is that the code can't find Chrome.exe itself.
It should be installed in this folder:
C:\Users\%USERNAME%\AppData\Local\Google\Chrome\Application\chrome.exe
Please check this on Requirements: http://code.google.com/p/selenium/wiki/ChromeDriver
P.s: I tested myself and it works now. :)

Use chrome with Selenium 2.0 with C#

I have a problem with the ChromeDriver.exe When I run the test, a Google Chrome Window is open but then an error from the chromedriver console shows up. It says something like:
[0405/175241: WARNING:scoped_temp_dir.cc<15>] Could not delete temp
dir in dtor.
Can anybody help me?....I'm Using C# by the way.
I wanned to upload an image but I couldn't because I'm a new user...
-JM
Selenium WebDriver C# in ChromeDriver:
Prerequisite: Install Visual Studio (mine is VS 2017), Google Chrome browser
Steps to follow:
Open VS 2017 and create solution/project
Write a test using C# code as below:
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("Your Test URL");
Now install "Selenium.WebDriver.ChromeDriver" by following steps:
Right click on Project -> Manage NuGet Packages...
Click Browse at the top and search for ChromeDriver
Select "Selenium.WebDriver.ChromeDriver" and install it
Execute/Run your test
Instead of moving your chromedriver.exe, when creating a new instance of a ChromeDriver you may put the exe's file path as a parameter. This is the same as for IE.
For example: driver = new ChromeDriver("C:\ChromeDriverFolder"); will look for the cromedriver.exe in a folder on the C drive called 'ChromeDriverFolder'.

Categories