Package net.sf.sahi.client

Examples of net.sf.sahi.client.ElementStub


    return StringUtils.equalsIgnoreCase( TINYMCE_TOOLBAR, descriptor.getType() );
  }

  @Override
  public ElementStub find( ElementDescriptor descriptor ) {
    return addParents( new ElementStub( CwbElementStub.TINYMCE_TOOLBAR, browser, descriptor.getSahiArguments() ),
                       descriptor );
    /*
    ElementStub element = addParents( browser.byId( descriptor.getSahiArguments() ), descriptor );

    if ( !element.exists() ) {
View Full Code Here


  @Override
  public ElementStub find( ElementDescriptor descriptor ) {
    return new TinyMceElementStub( tinyMce,
                                   addParents(
                                       new ElementStub( CwbElementStub.TINYMCE, browser,
                                                        descriptor.getSahiArguments() ),
                                       descriptor
                                   )
    );
  }
View Full Code Here

    );
  }

  @Override
  public void set( ElementDescriptor descriptor ) {
    ElementStub element = find( descriptor );
    String tinyMceId = element.getAttribute( "id" );

    boolean isHtml = false;
    String value = descriptor.getValue();

    if ( StringUtils.startsWith( value, HTML_LOOKUP_PREFIX ) ) {
View Full Code Here

    }
  }

  @Override
  public void verify( ElementDescriptor descriptor, boolean expectedOutcome ) {
    ElementStub element = find( descriptor );
    String tinyMceId = element.getAttribute( "id" );

    String text;
    String value = descriptor.getValue();

    if ( StringUtils.startsWith( value, HTML_LOOKUP_PREFIX ) ) {
View Full Code Here

    return StringUtils.startsWithIgnoreCase( descriptor.getType(), TYPE_FILE );
  }

  @Override
  public ElementStub find( ElementDescriptor descriptor ) {
    ElementStub stub = addParents( browser.file( descriptor.getSahiArguments() ), descriptor );

    if ( !stub.exists() && StringUtils.equalsIgnoreCase( descriptor.getType(), TYPE_FILE2 ) ) {
      // In case of file2 its possible the type has been changed to textbox
      return addParents( browser.textbox( descriptor.getSahiArguments() ), descriptor );
    }

    return stub;
View Full Code Here

  @Override
  public void set( ElementDescriptor descriptor ) {
    String fileName = determineFile( descriptor.getValue() );

    ElementStub fileStub = find( descriptor );

    if ( !fileStub.exists() ) {
      fail( "Could not find file input: " + descriptor );
    }

    if ( StringUtils.equalsIgnoreCase( descriptor.getType(), TYPE_FILE ) ) {
      // Do a simple set
      LOG.debug( "Performing a simple file set on " + descriptor );
      fileStub.setFile( fileName );
    }
    else {
      // Try setting with javascript and changing the element type
      // This might work in situations where the javascript requires the form to not be empty
      LOG.debug( "Performing a javascript change type file set on " + descriptor );

      browser.setFile( fileStub, fileName );

      // If it is still a file type, we should change it
      if ( !StringUtils.contains( fileStub.toString(), "textbox" ) ) {
        if ( browser.isIE() ) {
          browser.execute(
              fileStub + ".outerHTML = " + fileStub + ".outerHTML.replace(/type=['\"]?file['\"]?/, \"type=text\")" );
        }
        else {
          browser.execute( fileStub + ".type = \"text\";" );
        }

        addParents( browser.textbox( descriptor.getSahiArguments() ), descriptor ).setValue( fileName );
      }
      else {
        fileStub.setValue( fileName );
      }
    }
  }
View Full Code Here

    return StringUtils.equalsIgnoreCase( descriptor.getType(), TYPE );
  }

  @Override
  public ElementStub find( ElementDescriptor descriptor ) {
    return addParents( new ElementStub( CwbElementStub.PASSWORD, browser, descriptor.getSahiArguments() ), descriptor );
  }
View Full Code Here

    return addParents( new ElementStub( CwbElementStub.PASSWORD, browser, descriptor.getSahiArguments() ), descriptor );
  }

  @Override
  public void set( ElementDescriptor descriptor ) {
    ElementStub element = find( descriptor );
    element.setValue( descriptor.getValue() );
  }
View Full Code Here

    element.setValue( descriptor.getValue() );
  }

  @Override
  public void verify( ElementDescriptor descriptor, boolean expectedOutcome ) {
    ElementStub element = find( descriptor );
    assertEquals( expectedOutcome,
                  executeOperation( element.getValue(), descriptor.getValue(), descriptor.getOperation() ) );
  }
View Full Code Here

    return StringUtils.startsWithIgnoreCase( descriptor.getType(), TYPE );
  }

  @Override
  public ElementStub find( ElementDescriptor descriptor ) {
    return addParents( new ElementStub( CwbElementStub.BUTTON, browser, descriptor.getSahiArguments() ),
                       descriptor );
  }
View Full Code Here

TOP

Related Classes of net.sf.sahi.client.ElementStub

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.