Open url using Selenium Chromedriver c#

This is a simple example to show how to navigate to url using selenium chromedriver

Install selenium webdriver using Nuget Package

PM> Install-Package Selenium.WebDriver.ChromeDriver -Version 80.0.3987.10600

Below code performs a navigation to

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using System.Collections.ObjectModel;
using System.Threading;
using System.Configuration;

namespace OpenURL
    class Program
        static void Main(string[] args)
            IWebDriver driver = null;

                //driver = new ChromeDriver(@"c:\temp\");//load chromedriver from desired folder.
                driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);//load chromedriver from bin folder as nuget package deploys chrome driver .exe and other dlls into bin
                driver.Url = "";//Set the url you would like to navigate
            catch (Exception e)
                Console.WriteLine("Exception" + e.ToString());


Use bin or desired folder to load chrome driver

 driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);
//this helps loading chromedriver from bin folder
driver = new ChromeDriver(@"c:\temp\");
//this helps to load chromdriver.exe from temp folder.

Create simple application using Microsoft LUIS (1/2)

This article will help developers to create a simple AI application using Microsot LUIS. In the below example, we will be able to create one simple conversation with Microsoft LUIS. (Ex: who are you? ) and LUIS will understand command provided.

People may use various way to find out about one. So we are going to put all those sentences as intents  (Ex: Who are you? , what are you? , who. etc.,) 

go to

Click on Create new app

For an example i have given as “hello world”.

Once the app has been created, we need to create intents. There are lot of prebuilt intents available from microsoft that can be used. (Example  Music related, Fitness related, places, travel, etc.,)

the intent name is “Who”

this is where we start populating intent sentences for “Who“, i have given four sentences just for an article purpose.

once intents are populated, it is important to click on “Train”. this will be automatically added to the training data. If the train button shows red, then some new intents are not yet added to the model , so it is important the “Train” button shows green


once the data has been trained, you can perform  a small testing by providing various commands and monitor the top scoring intent. it should match the intent you have created.


Once the testing is done, proceed to publish tab and push it to production. It generates an URL which contains the key and the subscription id for the app.
This url will be used in the application


Continue to the next article to see the implementation of LUIS in .net

Access javascript variable from GeckoFx

This article helps developers to retrieve javascript variables from any webpage.
Two things are covered in the below code.

  • Injecting javascript into any webpage
  • Accessing javascript variable from the webpage.

Step 1: Navigating to the webpage (“”)

GeckoWebBrowser browser_gecko= new GeckoWebBrowser();
browser_gecko.DocumentCompleted += browser_DocumentCompleted_gecko;

private void browser_DocumentCompleted_gecko(object sender, GeckoDocumentCompletedEventArgs e)

            string jCode = " function variable() {return geckovariable;}"; // geckovariable is the variable name that exists in the webpage.
            GeckoElement script = browser_gecko.Document.CreateElement("script");
            script.TextContent = jCode;
            GeckoNode res = browser_gecko.Document.Head.AppendChild(script);

            string outString = "";
            AutoJSContext context = new AutoJSContext(browser_gecko.Window);
            JsVal result = context.EvaluateScript("variable()", browser_gecko.Window.DomWindow);

GeckoFx in WPF

Webbrowser component for WPF application. Default web browser component may have some limitation in terms of rendering webkits, html5.

GecoFx will help to render html5, etc.,
Below is a sample , how integrate GecoFx into your WPF Application

Install GecoFx from Nuget
PM> Install-Package GeckoFX -Version 1.0.5

Below are some of the functionalities frequency used with GeckoFx

  1. How to Invoke a script from GecoFx Control
    if user needs to execute a certain javascript function found in html page , you can use the below code to trigger the function.

    GeckoWebBrowser browser_gecko= new GeckoWebBrowser();
    browser_gecko.DocumentCompleted += browser_DocumentCompleted_gecko;

   , you can check the page source and check javascript code for reference. below code will execute the function geckofunctioncheck

    private void browser_DocumentCompleted_gecko(object sender, GeckoDocumentCompletedEventArgs e)
    AutoJSContext context = new AutoJSContext(browser_3w.Window); 


using Gecko;
using Gecko.Events;