Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
446 views
by
retagged by
Hi all,

I am learning a automation project using SpecFLow, NUnit and Autofac. I see a configuration in app.config with Autofac:

 <autofac>
    <components>
      <component name="IE" type="OpenQA.Selenium.IE.InternetExplorerDriver, WebDriver" service="OpenQA.Selenium.IWebDriver, WebDriver" instance-scope="per-dependency">
      </component>
      <component name="Chrome" type="OpenQA.Selenium.Chrome.ChromeDriver, WebDriver" service="OpenQA.Selenium.IWebDriver, WebDriver" instance-scope="per-dependency">
      </component>
      <component name="Firefox" type="OpenQA.Selenium.Firefox.FirefoxDriver, WebDriver" service="OpenQA.Selenium.IWebDriver, WebDriver" instance-scope="per-dependency">
      </component>
      <!-- Example of using an injected RemoteDriver:
      <component
              name="IE"
              type="Baseclass.Contrib.SpecFlow.Selenium.NUnit.RemoteWebDriver, Baseclass.Contrib.SpecFlow.Selenium.NUnit.SpecFlowPlugin"
              service="OpenQA.Selenium.IWebDriver, WebDriver"
              instance-scope="per-dependency">
        <parameters>
          <parameter name="url" value="http://127.0.0.1:4444/wd/hub" />
          <parameter name="browser" value="InternetExplorer">
          </parameter>
        </parameters>
      </component>-->
    </components>
  </autofac>

But i don't understand it, and i assume that they are used to configure which browser will be run at execution phase. Because i also don't find any browser type pointed in others stuffs.

So please help instruct me what it is and how to use it!

Many thanks in advance!

Kind regards,

MinMin

1 Answer

0 like 0 dislike
by
Autofac is mainly used for dependency injection at run-time and to maintain lifetime scope of an instance from the container.

With selenium, you are resolving Firefox, IE Driver, Chrome and RemoteWebDriver dependencies. Also, you are passing browser name and URL as a parameters. This should be used inside your code.

Share your code where you are initiating iWebDriver. We can help you more by looking at your code.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...