Verify browser title in Firefox browser in TestNG

package usinghtmlunit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.testng.annotations.Test;

import com.gargoylesoftware.htmlunit.BrowserVersion;

public class usingffbrowserintestng {

@Test
public void FacebookTitle()
{
WebDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_17);

((HtmlUnitDriver) driver).setJavascriptEnabled(true);

driver.get(“http://facebook.com”);

System.out.println(driver.getTitle());
}

@Test
public void GoogleTitle()
{
WebDriver driver = new HtmlUnitDriver(BrowserVersion.CHROME);

((HtmlUnitDriver) driver).setJavascriptEnabled(true);

driver.get(“http://google.com”);

System.out.println(driver.getTitle());
}

}

Leave a Reply

Your email address will not be published. Required fields are marked *