package demo.tests;

import net.serenitybdd.junit.runners.SerenityRunner;
import net.thucydides.core.annotations.Managed;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

@RunWith(SerenityRunner.class)
public class GoogleSerenityDriverIT {
    @Managed
    public WebDriver webdriver;

    @Test
    public void googleSearchTest() {
        // And now use this to visit Google
        webdriver.get("http://www.google.com");

        // Find the text input element by its name
        WebElement element = webdriver.findElement(By.name("q"));

        // Enter something to search for
        element.sendKeys("Cheese!");

        // Now submit the form. WebDriver will find the form for us from the element
        element.submit();

        // Check the title of the page
        System.out.println("Page title is: " + webdriver.getTitle());
    }

    public static void LegazyWebDriverTest(String[] args) {
        // Create a new instance of the html unit driver
        // Notice that the remainder of the code relies on the interface,
        // not the implementation.
        WebDriver driver = new HtmlUnitDriver();

        // And now use this to visit Google
        driver.get("http://www.google.com");

        // Find the text input element by its name
        WebElement element = driver.findElement(By.name("q"));

        // Enter something to search for
        element.sendKeys("Cheese!");

        // Now submit the form. WebDriver will find the form for us from the element
        element.submit();

        // Check the title of the page
        System.out.println("Page title is: " + driver.getTitle());

        driver.quit();
    }
}

@@ -282,60 +282,8 @@
 ent;
-%0Aimport org.openqa.selenium.htmlunit.HtmlUnitDriver;
 %0A%0A@R
@@ -962,816 +962,7 @@
    %7D
-%0A%0A    public static void LegazyWebDriverTest(String%5B%5D args) %7B%0A        // Create a new instance of the html unit driver%0A        // Notice that the remainder of the code relies on the interface,%0A        // not the implementation.%0A        WebDriver driver = new HtmlUnitDriver();%0A%0A        // And now use this to visit Google%0A        driver.get(%22http://www.google.com%22);%0A%0A        // Find the text input element by its name%0A        WebElement element = driver.findElement(By.name(%22q%22));%0A%0A        // Enter something to search for%0A        element.sendKeys(%22Cheese!%22);%0A%0A        // Now submit the form. WebDriver will find the form for us from the element%0A        element.submit();%0A%0A        // Check the title of the page%0A        System.out.println(%22Page title is: %22 + driver.getTitle());%0A%0A        driver.quit();%0A    %7D
 %0A%7D%0A

Remove useless code