View Javadoc

1   package com.atlassian.webdriver.confluence.component.sherpa;
2   
3   import com.atlassian.pageobjects.binder.Init;
4   import com.atlassian.webdriver.AtlassianWebDriver;
5   import com.atlassian.webdriver.utils.Search;
6   import org.openqa.selenium.By;
7   import org.openqa.selenium.WebElement;
8   
9   import javax.inject.Inject;
10  
11  /**
12   * TODO: Document this class / interface here
13   *
14   */
15  public class WelcomeScreen
16  {
17      private WebElement dialogComponent;
18      private WebElement dialogPanel;
19      private WebElement closeButton;
20      private WebElement title;
21      private WebElement showAtStartupTickbox;
22  
23      @Inject
24      AtlassianWebDriver driver;
25  
26      @Init
27      public void init()
28      {
29          By dialogComponentBy = By.id("second-user-dialog");
30  
31          driver.waitUntilElementIsVisible(dialogComponentBy);
32          dialogComponent = driver.findElement(dialogComponentBy);
33          dialogPanel = dialogComponent.findElement(By.className("dialog-button-panel"));
34          closeButton = Search.findElementWithText(By.tagName("button"), "Close", dialogPanel);
35          title = dialogComponent.findElement(By.className("dialog-title"));
36          showAtStartupTickbox = dialogPanel.findElement(By.id("hide-seconduser"));
37  
38          
39      }
40  
41      public void showAtStartup(boolean show)
42      {
43          if (show)
44          {
45              if (!showAtStartupTickbox.isSelected()) {
46                  showAtStartupTickbox.click();
47              }
48          }
49          else if (showAtStartupTickbox.isSelected())
50          {
51              showAtStartupTickbox.click();
52          }
53      }
54  
55      public String getTitle()
56      {
57          return title.getText();
58      }
59  
60      public void close()
61      {
62          closeButton.click();
63      }
64  
65  }