Base Class
Base Class
baseclass;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.sql.Driver;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.google.common.io.Files;
catch (Exception e) {
throw new Exception("Invalid");
}
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
return driver;
}
// get URL
}
// mouse over
} catch (Exception e) {
e.printStackTrace();
// throw new Exception("if the element is not present");
}
}
// current URL
// scroll
// send keys
// get title
// drop down
if (value.equals("index")) {
s.selectByIndex(Integer.parseInt(i));
} else if (value.equals("value")) {
s.selectByValue(value);
else if (value.equals("text")) {
s.selectByVisibleText(value);
}
}
// to click
// navigate to
// navigate back
// navigate forward
// navigate refresh
// get Text
// get Attribute
// radio button
// get options
// screen shot
// window handles
// Alerts
// close
public static void closee() {
driver.close();
}
// quit
public static void quitt() {
driver.quit();
}
// double click
public static void Doubleclickkk(WebElement element) {
Actions ac1 = new Actions(driver);
ac1.doubleClick(element).build().perform();
}
// click
public static void clickkk(WebElement element) {
Actions ac2 = new Actions(driver);
ac2.click(element).build().perform();
}
// right click
// robot
// i-Frames
// explicit wait
try {
WebDriverWait wb = new WebDriverWait(driver, 30);
wb.until(ExpectedConditions.visibilityOf(element));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// is displayed
try {
displayed = element.isDisplayed();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return displayed;
}
// is enabled
try {
enabled = element.isEnabled();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return enabled;
// is selected