0

firstly I'd like to point out I'm at "Hello, World!" level, with VERY limited coding abilities, I'm looking to progress in automated testing (currently manual only) and I've just encountered an issue with presumably my selenium webdriver, this is the issue I get: This is my code:

        using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;


namespace UnitTestProject2
{
    [TestClass]
    public class FirstSoftwareAuto

    {
        [TestMethod]
        public void First_Software_Login()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
            driver.Navigate().GoToUrl("//companyproductwebsite");
            IWebElement addUser = driver.FindElement(By.Name("Username"));
            addUser.SendKeys("//email");
        }
    }
}

I am honestly not sure as to what the issue is, here's the error I get bottom left of microsoft visual studio:

One of the helpful programmers at my company mentioned it's because it is trying to connect to localhost, however I do not understand why it isn't connecting to the internet.

Test Name:  First_Name_Login
Test FullName:  UnitTestProject2.FirstVantAuto.First_Software_Login
Test Source:    c:\users\Name\documents\visual studio 2015\Projects\UnitTestProject2\UnitTestProject2\UnitTest1.cs : line 15
Test Outcome:   Failed
Test Duration:  0:00:49.1936095

Result StackTrace:  
at OpenQA.Selenium.Firefox.FirefoxDriverServer.ConnectToBrowser(TimeSpan timeToWait)
   at OpenQA.Selenium.Firefox.FirefoxDriverServer.Start()
   at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute)
   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.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile)
   at OpenQA.Selenium.Firefox.FirefoxDriver..ctor()
   at UnitTestProject2.FirstSoftwareAuto.First_Software_Login() in c:\users\name\documents\visual studio 2015\Projects\UnitTestProject2\UnitTestProject2\UnitTest1.cs:line 16
Result Message: 
Test method UnitTestProject2.FirstSoftwareAuto.First_Software_Login threw exception: 
OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055

Any input would be much appreciated.

M G
  • 47
  • 1
  • 7
  • Are you using firefox version 47.0? – RemcoW Jun 17 '16 at 11:23
  • Yes I am, just reinstalled it. – M G Jun 17 '16 at 11:27
  • Check out the answer for this question: http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update/37765661#37765661 – RemcoW Jun 17 '16 at 11:29
  • Where would I add this bit of code? DesiredCapabilities capabilities = DesiredCapabilities.Firefox(); // Set Marionette on so the Grid will use this instead of normal FirefoxDriver capabilities.SetCapability("marionette", true); var driver = new RemoteWebDriver(capabilities); – M G Jun 17 '16 at 11:38

1 Answers1

0

Replace your WebDriver so it'll make use of marionette.

Change IWebDriver driver = new FirefoxDriver();

to var driver = new FirefoxDriver(new FirefoxOptions());

Also you need to download the MarionetteDriver, rename the executable to wires and add to your system path. The driver can be downloaded here. This is all mentioned in the duplicate I referenced to you in the comments.

Community
  • 1
  • 1
RemcoW
  • 4,196
  • 1
  • 22
  • 37
  • All done but now it is showing another error :/ any idea? – M G Jun 17 '16 at 13:34
  • Test method UnitTestProject2.FirstSoftwareAuto.First_Software_Login threw exception: System.InvalidOperationException: entity not found – M G Jun 17 '16 at 13:35