List of usage examples for org.openqa.selenium Point Point
public Point(int x, int y)
From source file:uk.q3c.krail.testbench.KrailTestBenchTestCase.java
License:Apache License
@Before public void baseSetup() throws Exception { System.out.println("setting up base test bench case"); addDriver(TestBench.createDriver(createFirefoxDriver())); getDriver().manage().window().setPosition(new Point(0, 0)); getDriver().manage().window().setSize(new Dimension(1024, 768)); System.out.println("default driver added"); System.out.println("current driver index set to " + currentDriverIndex); }
From source file:wsattacker.sso.openid.attacker.evaluation.SeleniumBrowser.java
License:Open Source License
public static WebDriver getWebDriver() { if (INSTANCE == null || hasQuit(INSTANCE) || INSTANCE.getWindowHandles().isEmpty()) { // create chrome profile //ChromeOptions options = new ChromeOptions(); //options.addExtensions(new File("adblock.crx")); FirefoxProfile profile = new FirefoxProfile(); // install adblock plus File tmpFile = new File("adblock.xpi"); try {/*from w ww. jav a 2 s. c om*/ InputStream inputStream = SeleniumBrowser.class.getResourceAsStream("/adblock_firefox.xpi"); FileUtils.copyInputStreamToFile(inputStream, tmpFile); profile.addExtension(tmpFile); } catch (IOException ex) { Logger.getLogger(EvaluationGui.class.getName()).log(Level.SEVERE, null, ex); } // disable local and session storage // some websites (e.g. stackoverflow) use those storages in addition // to session cookies profile.setPreference("dom.storage.enabled", false); // start new Firefox instance INSTANCE = new FirefoxDriver(profile); // screen size GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight(); width = width > 1440 ? 1440 : width; height = height > 900 ? 900 : height; INSTANCE.manage().window().setPosition(new Point(0, 0)); INSTANCE.manage().window().setSize(new Dimension(width, height)); tmpFile.delete(); } return INSTANCE; }