Friday, 5 September 2014

Selenium C# : How to Open Internet Explorer Browser using selenium webdriver with ASP.Net C#

Click Here to Download OpenInternetExplorerWithSeleniumWebDriverTool.zip

Note : If any runtime error occurred by running our downloaded project meaning of that your browser version and Selenium API DLL version is not matching. To resolve this issue you need to download latest Selenium C# API DLLs from this link and paste downloaded DLLs into 'Bin' folder of downloaded project. Or you can remove references of existing DLLs references and add new DLLs references. You can learn this thing from this link.


We can also open Internet Explorer Browser programmatically using selenium 'WebDriver' API with ASP.Net C#.

In previous article we learned How to Open Firefox Browser using selenium 'WebDriver'.

For opening or launching Internet Explorer (IE) is different from Open FireFox. In that we need one extra EXE file named 'IEDriverServer.exe' file and also set 'IE' Options object to give Startup URL.

If you Do not have 'IEDriverServer.exe' file file at that time Code gives us an error like :
The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable.

But basically it is very simple.

Here are steps to learn How to Open IE Browser :


STEP 1 : First create new 'WebSite' after creating new 'WebSite' add new page. On this previous article your learn this.

STEP 2 : Now, you need special Executable (EXE) file named "IEDriverServer.exe". You can download this file from this URL :
http://selenium-release.storage.googleapis.com/index.html. You can choose latest version folder on this link. Or you can also get this file from our project zip file, In our project we have both 32 and 64 bit zip file. You can get that file from zip file.

STEP 3 : After downloading file, Add new folder in your website or project named it 'EXEFiles' and copy your downloaded file 'IEDriverServer.exe' in this folder.

STEP 4 :  Open your new page code file like 'Default.aspx.cs' file. Import selenium 'namespaces' and write following code on 'Open Internet Explorer Browser' button click event.

Code File :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Selenium;
using OpenQA;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnOpenIEBrowser_Click(object sender, EventArgs e)
    {
        string STR_IE_DRIVER = Server.MapPath("EXEFiles"); //Set Path for EXE file

        var objIEOptions = new OpenQA.Selenium.IE.InternetExplorerOptions() // Set Options
        {
            InitialBrowserUrl = "www.google.com",
            IntroduceInstabilityByIgnoringProtectedModeSettings = true
        };

        //Create object for open IE
        OpenQA.Selenium.IE.InternetExplorerDriver objFF = new OpenQA.Selenium.IE.InternetExplorerDriver(STR_IE_DRIVER, objIEOptions);
    }
}

Explanation : In this code you can see that First we set path of 'IEDriverServer.exe' file, in which folder we save this file. After that, we create object of 'InternetExplorerOptions' class and set properties like 'InitialBrowserUrl' and 'IntroduceInstabilityByIgnoringProtectedModeSettings'.

This 'InitialBrowserUrl'  property use for By default when IE open this URL is open in IE. After that, we create object of 'InternetExplorerDriver' class to open IE. You can see that in constructor of 'InternetExplorerDriver' class we supply 'IE_DRIVER' Path and 'IE OPTION' object.

STEP 5 : Run the website. After Default page is appeared in browser, this website may run in any browser. You click on 'Open Internet Explorer Browser' button. It will Open Internet Explorer Successfully.

[Image : Run Website and open Page] :

Selenium C# : How to Open Internet Explorer Browser using selenium webdriver with ASP.Net C#
(To view original size image , click on image)

[Image : Internet Explorer Opened] :

Selenium C# : How to Open Internet Explorer Browser using selenium webdriver with ASP.Net C#
(To view original size image , click on image)


Full Video : 



42 comments:

  1. really well said about How to Open Internet Explorer Browser using selenium webdriver with ASP.Net C# keep share interesting article on selenium

    Selenium Training Institute in Chennai

    ReplyDelete
  2. Great article!!!!!This is very important information for us.I like all content and information.I have read it.You know more about this please visit again. Best Hadoop Training | Hadoop Online Training

    ReplyDelete
  3. Nice information about test automation tools my sincere thanks for sharing post Please continue to share this post..


    Weblogic Server 12cR2 Training

    ReplyDelete
  4. Thanks you for nice article.
    if you want to know the technologies updates,visit below site.
    Dot Net Tutorial for Beginners with Examples

    ReplyDelete

  5. Very Helpful Post And Explained Very Clearly About All the things.Very Helpful. Coming To Our Self We Provide Food Service Parts Through Out US At Very Affordable Prices And Also We Offer Same Day Shipping In US.We Offer Only Genuine Products.Really Thanks For Posting.

    ReplyDelete
  6. Thankful for the Informative Post The Best article, Bala Guntipalli

    ReplyDelete
  7. This Blog is very helpful and useful,came to know that i should be strong in my basics and this blog helps me to improve it,Chicago Immediate Care Services Provided by Us.Thanks For Posting.I Am refereed by my friend to this blog and i also want to refer my other friends to this blog.Really Thanks for posting such an informative post and thanks for sharing such knowledgeable posts.

    ReplyDelete
  8. This Blog Provides Very Useful and great Information. United States Medical Licensing Examination Thanks for sharing.

    ReplyDelete
  9. I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. 
    Devops training in velachry
    Devops training in OMR
    Deops training in annanagar
    Devops training in chennai
    Devops training in marathahalli
    Devops training in rajajinagar
    Devops training in BTM Layout


    ReplyDelete
  10. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    Data science training in velachery
    Data science training in kalyan nagar
    Data Science training in OMR
    Data Science training in anna nagar
    Data Science training in chennai
    Data Science training in marathahalli
    Data Science training in BTM layout
    Data Science training in rajaji nagar

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete


  12. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision.

    angularjs-Training in annanagar

    angularjs Training in chennai

    angularjs Training in chennai

    angularjs Training in bangalore

    ReplyDelete
  13. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    python training in OMR
    python training in tambaram
    python training in annanagar

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. The article you have shared is very useful. Selenium Testing is also talk of the town in today's digital world. So its very important to know and understand how we can open Internet Explorer Browser programmatically using selenium 'WebDriver' API with ASP.Net C#. All the guidelines and screenshots you have shared is really useful for all the information seeker who wants to know how it works. Thanks for sharing and keep posting like this.

    ReplyDelete
  17. Thanks for this blog are sharing information.

    7 tips to start a career in digital marketing

    “Digital marketing is the marketing of product or service using digital technologies, mainly on the Internet, but also including mobile phones, display advertising, and any other digital medium”. This is the definition that you would get when you search for the term “Digital marketing” in google. Let’s give out a simpler explanation by saying, “the form of marketing, using the internet and technologies like phones, computer etc”.

    we have offered to the advanced syllabus course digital marketing for available join now.

    more details click the link now.

    https://www.webdschool.com/digital-marketing-course-in-chennai.html

    ReplyDelete
  18. We provide you with flexible services and complete hybrid network solutions. It can provide your organisation with exceptional data speeds, advanced external security protection, and high-resilience by leveraging the latest SD-WAN and networking technologies to monitor, manage and strengthening your organisation’s existing network devices.

    https://www.quadsel.in/networking/
    https://twitter.com/quadsel/
    https://www.linkedin.com/company/quadsel-systems-private-limited/
    https://www.facebook.com/quadselsystems/

    #quadsel #network #security #technologies #managedservices #Infrastructure #Networking #OnsiteResources #ServiceDeskSupport #StorageServices #WarrantyAMCServices #datacentersolutions #DataCenterBuild #EWaste #InfraConsolidation #DisasterRecovery #NetworkingServices #ImagingServices #MPS #Consulting #WANOptimisation #enduserservices

    ReplyDelete
  19. good
    https://www.kaashivinfotech.com/best-final-year-project-in-information-technology/

    ReplyDelete
  20. nice

    https://www.kaashivinfotech.com/best-final-year-project-in-information-technology/

    ReplyDelete
  21. I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog.

    DevOps Training in Chennai

    DevOps Course in Chennai

    ReplyDelete
  22. Infycle Technologies, the top software training institute and placement center in Chennai offers the Best Digital Marketing course in Chennai for freshers, students, and tech professionals at the best offers. In addition to Digital Marketing, other in-demand courses such as DevOps, Data Science, Python, Selenium, Big Data, Java, Power BI, Oracle will also be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.

    ReplyDelete
  23. Them light phone show worker attack. Fly four oil seven until hour. Begin girl administration would than.news headlines

    ReplyDelete
  24. These quite herself give popular reason box. Security we more buy despite also. Meeting natural player because popular consider.top 10 news today

    ReplyDelete
  25. List Mrs also environmental gas bad. Down too door teacher.news headlines

    ReplyDelete