Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.FrameWindow


            }
            else if (window instanceof TopLevelWindow) {
                use = (event.getOldPage() == null);
            }
            else if (window instanceof FrameWindow) {
                final FrameWindow fw = (FrameWindow) window;
                final String enclosingPageState = fw.getEnclosingPage().getDocumentElement().getReadyState();
                final URL frameUrl = fw.getEnclosedPage().getWebResponse().getRequestSettings().getUrl();
                if (!HtmlPage.READY_STATE_COMPLETE.equals(enclosingPageState) || frameUrl == URL_ABOUT_BLANK) {
                    return;
                }

                // now looks at the visibility of the frame window
                final BaseFrame frameElement = fw.getFrameElement();
                if (frameElement.isDisplayed()) {
                    final ScriptableObject scriptableObject = frameElement.getScriptObject();
                    final ComputedCSSStyleDeclaration style = ((HTMLElement) scriptableObject).jsxGet_currentStyle();
                    use = (style.getCalculatedWidth(false, false) != 0)
                        && (style.getCalculatedHeight(false, false) != 0);
View Full Code Here


    private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, final URL url,
        final String charset) throws FailingHttpStatusCodeException, IOException {

        final HtmlPage page;
        if (webWindow instanceof FrameWindow) {
            final FrameWindow frameWindow = (FrameWindow) webWindow;
            page = frameWindow.getEnclosingPage();
        }
        else {
            Page currentPage = webWindow.getEnclosedPage();
            if (currentPage == null) {
                // Starting with a JavaScript URL; quickly fill an "about:blank".
View Full Code Here

    if (!(page instanceof HtmlPage)) {
      return;
    }

    if (((HtmlPage) page).getFrames().size() > 0) {
      FrameWindow frame = ((HtmlPage) page).getFrames().get(0);
      if (!(frame.getFrameElement() instanceof HtmlInlineFrame)) {
        switchTo().frame(0);
      }
    }
  }
View Full Code Here

    Page page = window.getEnclosedPage();
    if (page instanceof HtmlPage) {
      // Check for frames
      List<FrameWindow> frames = ((HtmlPage) page).getFrames();
      if (frames.size() > 0) {
        FrameWindow frameWindow = frames.get(0);
        if (HtmlFrame.class.isAssignableFrom(frameWindow.getFrameElement().getClass())) {
          currentWindow = frameWindow;
          return;
        }
      }
View Full Code Here

  protected WebDriver findActiveWindow() {
    WebWindow window = webClient.getCurrentWindow();
    HtmlPage page = (HtmlPage) window.getEnclosedPage();

    if (page != null && page.getFrames().size() > 0) {
      FrameWindow frame = page.getFrames().get(0);
      if (!(frame.getFrameElement() instanceof HtmlInlineFrame)) {
        return new HtmlUnitDriver(isJavascriptEnabled(), frame);
      }
    }

    if (currentWindow != null && currentWindow.equals(window)) {
View Full Code Here

     * @return the current selection
     */
    public Selection jsxFunction_getSelection() {
        // return null if the window is in a frame that is not displayed
        if (webWindow_ instanceof FrameWindow) {
            final FrameWindow frameWindow = (FrameWindow) webWindow_;
            if (!frameWindow.getFrameElement().isDisplayed()) {
                return null;
            }
        }
        return getSelection();
    }
View Full Code Here

        String responseText = page.asText();
        //System.out.println("page html-->\n" + responseText);
        //check page header
        assertTrue(-1 != responseText.indexOf("Tuscany DAS Web Sample"));

        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
        String menuResponseText = menuPage.asText();
        //System.out.println("menu html-->\n" + menuResponseText);
        //check main menu and sub menu
        assertTrue(-1 != menuResponseText.indexOf("Advanced Features"));
        assertTrue(-1 != menuResponseText.indexOf("OCC"));
View Full Code Here

    public void testDBRefresh() throws Exception{
        final String TEST_CASE = "DBRefresh";
        System.out.print("Running:" + TEST_CASE + "\t\t");

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
        HtmlButtonInput commandButton = (HtmlButtonInput)menuPage.getFormByName("MenuForm").getHtmlElementById("refreshButton");
        HtmlPage commandResult = null;
        if(commandButton != null){
          //System.out.println("command button text:"+commandButton.asText());
          commandButton.focus();
View Full Code Here

    public void testAllCompanies_Adhoc() throws Exception{
        final String TEST_CASE = "AllCompanies_Adhoc";
        System.out.print("Running:" + TEST_CASE + "\t\t\t");

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp");
        HtmlPage adhocPage = (HtmlPage)adhocAnchor.click();
        String adhocText = adhocPage.asText();
View Full Code Here

    public void testAllCompaniesDepartments_Command() throws Exception{
        final String TEST_CASE = "AllCompaniesDepartments_Command";
        System.out.print("Running:" + TEST_CASE + "\t\t");

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp");
        HtmlPage commandPage = (HtmlPage)commandAnchor.click();
        String commandText = commandPage.asText();
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.FrameWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.