forked from naveenanimation20/SeleniumJavaCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseclass.java
More file actions
59 lines (51 loc) · 1.65 KB
/
Copy pathBaseclass.java
File metadata and controls
59 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package Singleton;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Baseclass
{
public static WebDriver driver=null;
public static void initilize()
{
//Use Of Singleton Concept and Initilize webDriver
if(driver == null)
{
if(ConstantVariable.browserName.equalsIgnoreCase("chrome"))
{
System.setProperty("webdriver.chrome.driver", "F:\\Photon_Workspace\\SingletonPracticeProject\\Drivers\\chromedriver.exe");
driver=new ChromeDriver();
}
else if(ConstantVariable.browserName.equalsIgnoreCase("Firefox"))
{
System.setProperty("webdriver.gecko.driver", "F:\\Photon_Workspace\\SingletonPracticeProject\\Drivers\\geckodriver.exe");
driver=new FirefoxDriver();
}
else if(ConstantVariable.browserName.equalsIgnoreCase("IE"))
{
System.setProperty("webdriver.edge.driver", "F:\\Photon_Workspace\\SingletonPracticeProject\\Drivers\\MicrosoftWebDriver.exe");
driver=new EdgeDriver();
}
}
//Perform Basic Operations
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
}
public static void quit()
{
driver.quit();
driver=null; // we destroy the driver object after quit operation
}
public static void close()
{
driver.close();
driver=null; // we destroy the driver object after quit operation
}
public static void openurl(String URL)
{
driver.get(URL);
}
}