Interface CapybaraPortingLayer

All Known Subinterfaces:
BuildStep, PageArea, PostBuildStep, Step
All Known Implementing Classes:
AbstractCredentialsTest, AbstractDashboardViewPortlet, AbstractJUnitTest, AbstractListViewColumn, AbstractPipelineTest, AbstractStep, Action, ActiveDirectorySecurityRealm, AggregateDownstreamTestResults, AntBuildStep, AntInstallation, Artifact, ArtifactArchiver, ArtifactManagement, ArtifactManagement.Factory, ArtifactoryGlobalConfig, ArtifactoryGlobalConfig.Server, ArtifactoryGradleConfiguratior, ArtifactoryPublisher, AuditTrailGlobalConfiguration, AuditTrailLogger, AuthorizationStrategy, Axis, BaseStandardCredentials, BatchCommandBuildStep, BranchSource, BreadCrumbs, Build, BuildAccessControl, BuildDescriptionSetter, BuildExecutorStatus, BuildHistory, BuildParameters, BuildStatisticsPortlet, BuildTimeout, BuildTrigger, BuildTriggerConfig, BuildWithParameters, BuildWrapper, CapybaraPortingLayerImpl, Changes, Cloud, CoberturaAction, CoberturaPublisher, CodeMirror, ColumnsArea, CommandSlaveLauncher, CompressingArtifactManager, ComputerConnector, ComputerLauncher, ConfigFileProvider, ConfigurablePageObject, ContainerPageObject, Control, CopyArchivedArtifactsBuildStep, CopyArtifactBuildStep, Credential, CredentialsBinding, CredentialsPage, CustomConfig, DashboardPortlets, DashboardView, DeployPublisher, DiskUsage, DiskUsageGlobalConfig, DockerBuildStep, DockerCommand, DockerCommand.CreateContainer, DockerCommand.CreateImage, DockerCommand.RemoveContainers, DockerCommand.StartContainers, Domain, DomainPage, DumbSlave, EmailExtPublisher, EnvInjectAction, EnvInjectConfig, EnvInjectConfig.Environment, EnvInjectConfig.Property, EnvInjectStep, ExternalGlobalConfig, ExternalNodeConfig, FileBuildParameters, FileCredentials, Fingerprint, Folder, FreeStyleJob, FreeStyleMultiBranchJob, GerritTriggerJob, GerritTriggerNewServer, GerritTriggerServer, GitblitScm, GitBranchSource, GithubBranchSource, GitLabBranchSource, GitLabOrganizationFolder, GitLabPersonalAccessTokenCredential, GitLabScm, GitLabServerConfig, GitScm, GitScm.AdvancedCheckout, GitScm.AdvancedClone, GitScm.Behaviour, GitScm.CalculateChangelog, GitScm.CheckoutToLocalBranch, GitScm.CheckoutToLocalDir, GitScm.CleanAfterCheckout, GitScm.CleanBeforeCheckout, GitScm.CommitAuthorInChangelog, GitScm.CreateTagForBuild, GitScm.CustomNameAndMail, GitScm.CustomSCMName, GitScm.ForcePollingUsingWorkspace, GitScm.GitLfsPull, GitScm.MergeBeforeBuild, GitScm.NoBuildOnCommit, GitScm.PollingIgnoresMessage, GitScm.PollingIgnoresPath, GitScm.PollingIgnoresUser, GitScm.PruneStableRemoteBranches, GitScm.RecursiveSubmodules, GitScm.SparseCheckoutPaths, GitScm.StrategyToChooseBuild, GitScm.WipeAndForceClone, GlobalConfig, GlobalDockerConfig, GlobalPluginConfiguration, GlobalSecurityConfig, GlobalToolConfig, GradleInstallation, GradleStep, GroovyInstallation, GroovyPostBuildStep, GroovyStep, HtmlPublisher, HtmlPublisher.Report, HtmlReport, JabberGlobalConfig, JabberGlobalConfig.AdvancedConfig, JabberGlobalConfig.EnabledConfig, JabberGlobalConfig.MUCConfig, JabberPublisher, JabberPublisher.Publishers, JacocoPublisher, JacocoResultPage, JavadocPublisher, JcascManage, JdkInstallation, Jenkins, JenkinsConfig, JenkinsDatabaseSecurityRealm, JenkinsDatabaseSecurityRealm.Signup, JenkinsLogger, JGitInstallation, JiraGlobalConfig, JiraUpdater, Job, JobConfigHistory, JobConfigHistory.Change, JobDslBuildStep, JobFiltersArea, JobsGridPortlet, JobsMixIn, JUnitPublisher, LabelAxis, LabelExpressionAxis, LabelParameter, LastConsoleColumn, LatestBuildsPortlet, LdapGroupMembershipStrategy, LdapSecurityRealm, LdapSecurityRealm_Pre1_10, ListView, LocalSlaveController, LoggedInAuthorizationStrategy, Login, Logout, LogParserGlobalConfig, LogParserOutputPage, LogParserPublisher, Mailer, MailerGlobalConfig, MainArea, MainPanel, ManagedCredentials, ManagedCredentialsBinding, MatrixAuthorizationStrategy, MatrixBuild, MatrixConfiguration, MatrixProject, MatrixReloadedAction, MatrixRow, MatrixRun, MavenBuild, MavenBuildStep, MavenInstallation, MavenModule, MavenModuleBuild, MavenModuleSet, MavenProjectConfig, MavenSettingsConfig, MixIn, MockSecurityRealm, MSBuildInstallation, MSBuildStep, MSTestRunnerBuildStep, NestedView, Node, NodeParameter, OnlineStatusNotification, PageAreaImpl, PageObject, Parameter, ParameterizedTrigger, ParseUserAttributeLdapGroupMembershipStrategy, PasswordParameter, PendingScript, PendingSignature, PhabricatorScm, Plugin, PluginManager, PostBuildScript, PriorityConfig, PriorityConfig.Group, ProjectBasedMatrixAuthorizationStrategy, ProjectDefaultBuildAccessControl, ProjectDescriptionSetter, ProjectMatrixProperty, ProjectStatusStdJobList, ProvidedFile, Rvm, Scm, ScmPolling, Script, ScriptApproval, Scriptler, SearchForGroupsLdapGroupMembershipStrategy, SecretFileCredentialsBinding, SecretStringCredentialsBinding, SecurityDisabler, SecurityRealm, ServerCredentialMapping, ServletSecurityRealm, ShellBuildStep, Slave, SlaveController, SlavesMixIn, SnippetGenerator, SshCredentialDialog, SshPrivateKeyCredential, SshPrivateKeyCredential.Direct, SshSlaveConnector, SshSlaveLauncher, StageView, StringCredentials, StringParameter, SubversionScm, SubversionSvmAdvanced, SvnRepositoryBrowser, SvnRepositoryBrowserWebSvn, SystemGroovyStep, TestStatisticsChartPortlet, TextAxis, TextFinderPublisher, TextParameter, TimerTrigger, TimstamperGlobalConfig, ToolInstallation, TopLevelItem, Trigger, TriggerCallBuildStep, TriggerConfig, UnstableJobsPortlet, UpdateCenter, UpstreamJobTrigger, User, UserPwdCredential, View, ViewgitScm, ViewsMixIn, WizardCreateAdminUser, WizardCustomizeJenkins, WizardLogin, WorkflowGithubSharedLibrary, WorkflowJob, WorkflowMultiBranchJob, WorkflowSharedLibrary, WorkflowSharedLibraryGlobalConfig, Workspace, WsCleanup, WsCleanup.PostBuild, WsCleanup.PreBuild, XUnitPublisher, XUnitPublisher.Tool, XvncGlobalJobConfig, XvncJobConfig

public interface CapybaraPortingLayer
Interface for assisting porting from Capybara.
Author:
christian.fritz
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ByFactory
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<org.openqa.selenium.WebElement>
    all(org.openqa.selenium.By selector)
    Finds all the elements that match the selector.
    void
    blur(org.openqa.selenium.WebElement e)
    Sends a blur event to the provided element
    void
    check(String locator)
    Checks the specified checkbox.
    void
    check(org.openqa.selenium.WebElement e)
    Checks the checkbox.
    void
    check(org.openqa.selenium.WebElement e, boolean state)
    Sets the state of the checkbox to the specified value.
    org.openqa.selenium.WebElement
    choose(String locator)
    Select radio button by its name, id, or label text.
    void
     
    void
    clickLink(String locator)
     
    void
    confirmAlert(int timeout)
    Deprecated.
    Use runThenConfirmAlert(Runnable, int) and provide the runnable that triggers the alert.
    executeScript(String javaScript, Object... args)
    Executes JavaScript.
    void
    fillIn(String formFieldName, Object value)
     
    org.openqa.selenium.WebElement
    find(org.openqa.selenium.By selector)
    Returns the first visible element that matches the selector.
    org.openqa.selenium.WebElement
    findIfNotVisible(org.openqa.selenium.By selector)
    Returns the first element that matches the selector even if not visible.
    org.openqa.selenium.WebElement
    getElement(org.openqa.selenium.By selector)
    Works like find(org.openqa.selenium.By) but instead of throwing an exception, this method returns null.
    Get all text of the page including markup.
    org.openqa.selenium.WebElement
    last(org.openqa.selenium.By selector)
    Picks up the last visible element that matches given selector.
    org.openqa.selenium.WebElement
    lastIfNotVisible(org.openqa.selenium.By selector)
    Picks up the last visible element that matches given selector.
    void
    runThenConfirmAlert(Runnable runnable, int timeout)
    Do something that triggers an alert then giving it some time to appear
     
    org.openqa.selenium.WebElement
    waitFor(org.openqa.selenium.By selector)
    Wait until the element that matches the given selector appears.
    org.openqa.selenium.WebElement
    waitFor(org.openqa.selenium.By selector, int timeoutSec)
    Wait until the element that matches the given selector appears.
    <MatcherT, SubjectT extends MatcherT>
    void
    waitFor(SubjectT item, org.hamcrest.Matcher<MatcherT> matcher, int timeoutSec)
    Wait until a matcher matches.
    <T> Wait<T>
    waitFor(T subject)
     
    <T> T
    Deprecated.
    <T> T
    waitForCond(Callable<T> block, int timeoutSec)
    Deprecated.
  • Field Details

  • Method Details

    • clickButton

      void clickButton(String text)
    • choose

      org.openqa.selenium.WebElement choose(String locator)
      Select radio button by its name, id, or label text.
    • waitFor

      <T> Wait<T> waitFor(T subject)
    • waitFor

    • waitFor

      org.openqa.selenium.WebElement waitFor(org.openqa.selenium.By selector, int timeoutSec)
      Wait until the element that matches the given selector appears.
    • waitFor

      org.openqa.selenium.WebElement waitFor(org.openqa.selenium.By selector)
      Wait until the element that matches the given selector appears.
    • waitForCond

      @Deprecated <T> T waitForCond(Callable<T> block, int timeoutSec)
      Deprecated.
      Repeated evaluate the given predicate until it returns true.

      If it times out, an exception will be thrown.

      Parameters:
      timeoutSec - 0 if left to the default value
    • waitForCond

      @Deprecated <T> T waitForCond(Callable<T> block)
      Deprecated.
    • waitFor

      <MatcherT, SubjectT extends MatcherT> void waitFor(SubjectT item, org.hamcrest.Matcher<MatcherT> matcher, int timeoutSec)
      Wait until a matcher matches.
    • find

      org.openqa.selenium.WebElement find(org.openqa.selenium.By selector)
      Returns the first visible element that matches the selector.
      Throws:
      org.openqa.selenium.NoSuchElementException - if the element is not found.
      See Also:
    • findIfNotVisible

      org.openqa.selenium.WebElement findIfNotVisible(org.openqa.selenium.By selector)
      Returns the first element that matches the selector even if not visible.
      Throws:
      org.openqa.selenium.NoSuchElementException - if the element is not found.
      See Also:
    • getElement

      org.openqa.selenium.WebElement getElement(org.openqa.selenium.By selector)
      Works like find(org.openqa.selenium.By) but instead of throwing an exception, this method returns null.
    • fillIn

      void fillIn(String formFieldName, Object value)
    • check

      void check(org.openqa.selenium.WebElement e)
      Checks the checkbox.
    • check

      void check(org.openqa.selenium.WebElement e, boolean state)
      Sets the state of the checkbox to the specified value.
    • blur

      void blur(org.openqa.selenium.WebElement e)
      Sends a blur event to the provided element
    • all

      List<org.openqa.selenium.WebElement> all(org.openqa.selenium.By selector)
      Finds all the elements that match the selector.

      Note that this method inherits the same restriction of the WebDriver.findElements(org.openqa.selenium.By), in that its execution is not synchronized with the JavaScript execution of the browser.

      For example, if you click something that's expected to populate additional DOM elements, and then call all() to find them, then all() can execute before those additional DOM elements are populated, thereby failing to find the elements you are looking for.

      In contrast, find(org.openqa.selenium.By) do not have this problem, because it waits until the element that matches the criteria appears.

      So if you are using this method, think carefully. Perhaps you can use find(org.openqa.selenium.By) to achieve what you are looking for (by making the query more specific), or perhaps you can combine this with waitForCond(java.util.concurrent.Callable) so that if you don't find the elements you are looking for in the list, you'll retry.

    • last

      org.openqa.selenium.WebElement last(org.openqa.selenium.By selector)
      Picks up the last visible element that matches given selector.
    • lastIfNotVisible

      org.openqa.selenium.WebElement lastIfNotVisible(org.openqa.selenium.By selector)
      Picks up the last visible element that matches given selector.
    • executeScript

      Object executeScript(String javaScript, Object... args)
      Executes JavaScript.
    • clickLink

      void clickLink(String locator)
      Parameters:
      locator - Text, ID, or link.
    • check

      void check(String locator)
      Checks the specified checkbox.
    • confirmAlert

      @Deprecated void confirmAlert(int timeout)
      Deprecated.
      Use runThenConfirmAlert(Runnable, int) and provide the runnable that triggers the alert.
      Confirms an alert giving it some time to appear
      Parameters:
      timeout - Maximum time to wait for the alert to appear, in seconds
    • runThenConfirmAlert

      void runThenConfirmAlert(Runnable runnable, int timeout)
      Do something that triggers an alert then giving it some time to appear
      Parameters:
      runnable - Something that will trigger the alert
      timeout - Maximum time to wait for the alert to appear, in seconds
    • getPageSource

      String getPageSource()
      Get all text of the page including markup.