Friday, 4 August 2017

Code Example - FireFox Profile

package com.practiceCode;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

/**
 * @Blog Name : Selenium Code Example
 * @author Deepak Gupta
 * @Created Date 4-08-2017
 *
 */
public class FireFoxProfileExample {

WebDriver driver;

@BeforeTest
public void setUp() {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/drivers/geckodriver.exe");
// Create object of webdriver's inbuilt class ProfilesIni to access Its method getProfile.
ProfilesIni firProfiles = new ProfilesIni();
// Get access of newly created profile WebDriver_Profile.
FirefoxProfile wbdrverprofile = firProfiles.getProfile("WebDriver_Profile");
// Pass wbdrverprofile parameter to FirefoxDriver.
driver = new FirefoxDriver(wbdrverprofile);
}

@Test
public void OpenURL() {
driver.get("http://only-testing-blog.blogspot.in/2014/05/login.html");
}

@AfterTest
public void tearDown() throws InterruptedException {
Thread.sleep(2000);
driver.quit();
}

}

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...