public BaseWebDriverImpl(String projectDirName, String browserURL, WebDriver webDriver) {

    super(webDriver);

    _projectDirName = projectDirName;

    if (OSDetector.isWindows()) {
      _dependenciesDirName = StringUtil.replace(_dependenciesDirName, "//", "\\");

      _outputDirName = StringUtil.replace(_outputDirName, "//", "\\");

      _projectDirName = StringUtil.replace(_projectDirName, "//", "\\");

      _sikuliImagesDirName = StringUtil.replace(_sikuliImagesDirName, "//", "\\");
      _sikuliImagesDirName = StringUtil.replace(_sikuliImagesDirName, "linux", "windows");
    }

    if (!TestPropsValues.MOBILE_DEVICE_ENABLED) {
      WebDriver.Options options = webDriver.manage();

      WebDriver.Window window = options.window();

      int x = 1065;
      int y = 1040;

      window.setSize(new Dimension(x, y));
    }

    webDriver.get(browserURL);
  }
  protected void maximizeChromeBrowser(WebDriver.Window window) {
    // Chrome driver does not yet support maximizing. Let' apply black magic!
    Toolkit toolkit = Toolkit.getDefaultToolkit();

    Dimension screenResolution =
        new Dimension(
            (int) toolkit.getScreenSize().getWidth(), (int) toolkit.getScreenSize().getHeight());

    window.setSize(screenResolution);
    window.setPosition(new Point(0, 0));
  }
  public static Point getWindowPoint(WebDriver webDriver) {
    WebElement bodyWebElement = getWebElement(webDriver, "//body");

    WrapsDriver wrapsDriver = (WrapsDriver) bodyWebElement;

    WebDriver wrappedWebDriver = wrapsDriver.getWrappedDriver();

    WebDriver.Options options = wrappedWebDriver.manage();

    WebDriver.Window window = options.window();

    return window.getPosition();
  }
Example #4
0
  public Logger(LiferaySelenium liferaySelenium) {
    _liferaySelenium = liferaySelenium;

    WebDriver.Options options = _webDriver.manage();

    WebDriver.Window window = options.window();

    window.setPosition(new Point(1000, 50));
    window.setSize(new Dimension(600, 700));

    JavascriptExecutor javascriptExecutor = (JavascriptExecutor) _webDriver;

    javascriptExecutor.executeScript("window.name = 'Log Window';");
  }
  @Override
  public void setWindowSize(String coordString) {
    WebElement bodyWebElement = getWebElement("//body");

    WrapsDriver wrapsDriver = (WrapsDriver) bodyWebElement;

    WebDriver webDriver = wrapsDriver.getWrappedDriver();

    WebDriver.Options options = webDriver.manage();

    WebDriver.Window window = options.window();

    String[] screenResolution = StringUtil.split(coordString, ",");

    int x = GetterUtil.getInteger(screenResolution[0]);
    int y = GetterUtil.getInteger(screenResolution[1]);

    window.setSize(new Dimension(x, y));
  }
  public BaseWebDriverImpl(String projectDirName, String browserURL, WebDriver webDriver) {

    super(webDriver);

    String dependenciesDirName =
        "portal-web//test//functional//com//liferay//portalweb//" + "dependencies//";

    String outputDirName = TestPropsValues.OUTPUT_DIR_NAME;

    String sikuliImagesDirName = dependenciesDirName + "sikuli//linux//";

    if (OSDetector.isWindows()) {
      dependenciesDirName = StringUtil.replace(dependenciesDirName, "//", "\\");

      outputDirName = StringUtil.replace(outputDirName, "//", "\\");

      projectDirName = StringUtil.replace(projectDirName, "//", "\\");

      sikuliImagesDirName = StringUtil.replace(sikuliImagesDirName, "//", "\\");
      sikuliImagesDirName = StringUtil.replace(sikuliImagesDirName, "linux", "windows");
    }

    _dependenciesDirName = dependenciesDirName;
    _outputDirName = outputDirName;
    _projectDirName = projectDirName;
    _sikuliImagesDirName = sikuliImagesDirName;

    if (!TestPropsValues.MOBILE_DEVICE_ENABLED) {
      WebDriver.Options options = webDriver.manage();

      WebDriver.Window window = options.window();

      int x = 1280;
      int y = 1040;

      window.setSize(new Dimension(x, y));
    }

    webDriver.get(browserURL);
  }