Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.standardchartered.s2b.utility.Constant;
public final class WebdriverFactory {
private static WebdriverFactory WebdriverFactoryInstance = new WebdriverFactory();
//private static WebdriverFactory WebdriverFactoryInstance;
private WebdriverFactory()
{
System.out.println("Receiving request to create instance for WebDriverFactory...");
if( WebdriverFactoryInstance != null )
{
System.out.println("Instance request: Declined..........");
throw new InstantiationError("Cannot Create Instance for WebdriverFactory class");
}
}
ThreadLocal<WebDriver> DRIVER_INSTANCE = new ThreadLocal<WebDriver>(){
@Override
protected WebDriver initialValue()
{
System.out.println("Initiating Driver ...............");
/************Pasted the code from openBrowser *****************/
System.setProperty("webdriver.chrome.driver",Constant.driverPath_chrome);
ChromeOptions co = new ChromeOptions();
co.addArguments("disable-extensions");
co.addArguments("test-type");
co.addArguments("--start-maximized");
//To set download path
String downloadFilepath = Constant.download_dir;
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", downloadFilepath);
co.setExperimentalOption("prefs", chromePrefs);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, co);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(ChromeOptions.CAPABILITY, co);
/********************************************************************/
System.out.println("WebDriver Instance Creation : Successfull ..");
return new ChromeDriver(capabilities);
}
};
public static WebdriverFactory getInstance()
{
System.out.println("Requesting for WebDriverFactory instance....");
return WebdriverFactoryInstance;
}
public WebDriver getDriver()
{
System.out.println("Requesting for WebDriver Instance....");
return DRIVER_INSTANCE.get();
}
public void removeDriver() // Quits the driver and closes the browser
{
if(DRIVER_INSTANCE!=null)
{
System.out.println("Browser instance closing inprogress");
DRIVER_INSTANCE.get().close();
System.out.println("is Driver Instance closed ? -> Yes");
DRIVER_INSTANCE.get().quit();
System.out.println("is Driver Quit ? ->Yes");
DRIVER_INSTANCE.remove();
System.out.println("Driver reference removal : Successfull");
}
}
}
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team