Share
Go down
lilsammy
Posts : 2
Join date : 2012-08-14

Outputting to console as events happen. C#

on Tue Aug 14, 2012 5:22 pm
I have a C# windows form application using Selenium.

The program writes what its doing to a rich text box as it does it but after the browser launches the events wont be written to the rich text box as they happen they will be all output after the webdriver has finished carrying out its actions.

My code looks like this:
Code:
  var ProxyIP = "xxx.xxx.xx.xxx:80";

        RtbConsole.AppendText("Setting Up Firefox\n");

        //Firefox driver + proxy setup
        FirefoxProfile profile = new FirefoxProfile();
        String PROXY = ProxyIP;
        OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
        proxy.HttpProxy = PROXY;
        proxy.FtpProxy = PROXY;
        proxy.SslProxy = PROXY;
        profile.SetProxyPreferences(proxy);

        RtbConsole.AppendText("Launching Firefox\n");
        FirefoxDriver driver = new FirefoxDriver(profile);

        RtbConsole.AppendText("Navigating to removed link \n");
        driver.Navigate().GoToUrl("removed link");


        IWebElement ip = driver.FindElement(By.XPath("/html/body/div/div/h1/span"));
        var myIP = ip.Text;

        RtbConsole.AppendText("Checking IP for Proxy\n");
        if (ProxyIP == myIP + ":80") {
            RtbConsole.AppendText("Proxy Test: Success\n");
        } else {
            RtbConsole.AppendText("Proxy Test: Failed\n");
        }

        //Close the browser
        driver.Quit();

If anyone can explain what I need to do to make it write to console as the actions happen instead of after it finishes that would be awesome.
lilsammy
Posts : 2
Join date : 2012-08-14

Re: Outputting to console as events happen. C#

on Mon Aug 20, 2012 4:47 pm
Bump still looking for a solution to this.
Back to top
Permissions in this forum:
You cannot reply to topics in this forum