How to create Instance of Google Chrome. RRS feed

  • Question

  • I want to create an object for google chrome and do like this.

    dynamic browserId = Type.GetTypeFromProgID("InternetExplorer.Application.1");                       
            dynamic ie = Activator.CreateInstance(browserId);            
            ie.AddressBar = true;
            ie.MenuBar = false;
            ie.ToolBar = false;
            ie.StatusBar = false;
            ie.MenuBar = false;
            ie.Visible = true;

    Above code is working for IE but I want to do same for google chrome

    Tuesday, April 17, 2018 11:30 AM

All replies

  • Chrome does not support COM automation. You need an extension or a browser automation tool:


    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Proposed as answer by Fei Hu Wednesday, April 18, 2018 2:12 AM
    Tuesday, April 17, 2018 12:34 PM
  • Thanks for your quick reply.

    Is it possible to control Google Chrome from C# code?

    Means can I able to replace existing URL and put new URL and after that refresh same page using C# code(I am not using ASP.NET). Actually, I want to control Google Chrome event. It includes start Google Chrome, Hides address bar, Opens an URL, replaces URL with new URL and refreshes the same browser window.

    Wednesday, April 18, 2018 4:26 AM
  • Hello RavindraNathKashyap,

    Try to use Selenium tools, which could do any normal thing with browser. Of course including replace url, open tab or others.

    A quickly started as below.

    How to execute Selenium Webdriver in Chrome Browser

    Best Regards,

    Neil Hu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 18, 2018 6:34 AM
  • Is it possible to control Google Chrome from C# code?.

    Yes, with UI Automation.

    (you can check with SDK tool Inspect)

    • Proposed as answer by Fei Hu Tuesday, April 24, 2018 9:35 AM
    Wednesday, April 18, 2018 6:57 AM