1

I made a login automation application with C# + .NET - MVC.

My application works perfectly on my local computer and saves everything on the database.

Once I deployed my application on our local machine, the Index View receives the email and password, sends them to the database and saves them. The next step firing up a WebDriver (Firefox or Chrome worked on laptop) with Selenium. Here, nothing happens. It keeps waiting on the localhost forever and both Chrome and FF timeout after a certain period of time.

    [HttpGet]
    public ActionResult Index()
    {
        return View();
    }

    [HttpPost]
    public ActionResult getInformation()
    {
        email = Request["getEmail"].ToString();
        password = Request["getPassword"].ToString();
        saveLogin();
        return RedirectToAction("gatherer");
    }

    public ActionResult gatherer()
    {
        facebookLogin();
        return null;
    }

    private static void facebookLogin()
    {
        chrome = new FirefoxDriver();
        chrome.Navigate().GoToUrl("http://facebook.com");
        chrome.FindElement(By.Id("email")).SendKeys(email);
        chrome.FindElement(By.Id("pass")).SendKeys(password);
        chrome.FindElement(By.Id("loginbutton")).Click();
    }

This is very simple and it worked on my local computer again. But deployed on IIS on the server, it doesn't. In other words : the webdriver never opens.

1 Answer 1

1

First you need to change from

chrome = new FirefoxDriver();

To

DesiredCapabilities capability = DesiredCapabilities.Firefox();
Uri url = new Uri("http://REMOTE_IP:5050/wd/hub");
IWebDriver chrome = new RemoteWebDriver(url, capability);

Then Download Selenium Standalone server and use command prompt to initiate it using

java -jar C:\selenium-server-standalone-2.24.1.jar -interactive -port 5050
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.