Creating Controller Class

Make sure to read my Getting Started with Selenium blogpost to get set up to create automation tests. Then, watch the video below to Create a Controller class, which will interact with web elements on the web page.

Advertisements

Getting Started with Selenium

  1. Install Java SE Development Kit 8
  2. Install IntelliJ 15
  3. Launch IntelliJ 15
    • Navigate through setting up your java environment (if first opened)
    • Make sure to enable TestNG and Maven plugins
  4. Click Create New ProjectScreen Shot 2016-03-13 at 12.17.18 PM
  5. Create a Maven Project and Select Project SDK that was downloaded earlier then click nextScreen Shot 2016-03-13 at 12.19.58 PM
  6. Enter GroupId, ArtifactId, and Version for your new project then click nextScreen Shot 2016-03-13 at 12.22.56 PM
  7. Enter Project Name and Project directory then click finishScreen Shot 2016-03-13 at 12.24.35 PM
  8. ****Make sure to enable auto import maven projects******Screen Shot 2016-03-13 at 12.27.12 PM
  9. Paste the following dependencies tag to your pom.xml to use selenium in your web automation tests and TestNG capabilities. *wait until all processes finish*
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.52.0</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
  10. Now you have the basic for creating tests with selenium in IntelliJ using Java language. Make sure to watch my tutorials on how to create Drivers, Controllers, and a TestBase to create your first web automation test.