/**
  * @param Admin $I
  */
 public function tryToTest(Admin $I)
 {
     // Select page module
     $I->wantToTest('Add a page with page module');
     $I->click('Page');
     // New page from root page
     $typo3NavigationContainer = '#typo3-navigationContainer';
     $I->waitForElement($typo3NavigationContainer);
     $rootNode = 'a.x-tree-node-anchor > span';
     $rootNodeIcon = '#extdd-1 > span.t3js-icon.icon.icon-size-small.icon-state-default.icon-apps-pagetree-root';
     $contextMenuNew = '#typo3-pagetree-contextmenu > ul > li.x-menu-list-item:nth-of-type(2) > a > span.x-menu-item-text';
     $I->waitForElement($rootNode);
     $I->click($rootNodeIcon);
     $I->waitForElement($contextMenuNew);
     $I->click($contextMenuNew);
     // Switch to content frame
     $I->switchToIFrame('content');
     // New page select position wizard
     $I->click('i[title="Insert the new page here"]');
     // FormEngine new page record
     $saveButton = 'body > div > div.module-docheader.t3js-module-docheader > div.module-docheader-bar.module-docheader-bar-buttons.t3js-module-docheader-bar.t3js-module-docheader-bar-buttons > div.module-docheader-bar-column-left > div > div > button:nth-child(1)';
     $I->waitForElement($saveButton);
     // Check empty
     $I->amGoingTo('check empty error');
     $I->click($saveButton);
     $I->wait(2);
     $editControllerDiv = '#EditDocumentController > div';
     $generalTab = $editControllerDiv . ' > div:nth-child(1) > ul > li';
     $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use($generalTab) {
         return $webdriver->findElement(\WebDriverBy::cssSelector($generalTab))->getAttribute('class');
     });
     $I->assertContains('has-validation-error', $classString);
     // Add page
     $pageTitle = $editControllerDiv . ' > div:nth-child(1) > div > div.tab-pane:nth-child(1) > fieldset:nth-child(2) > div > div:nth-child(1) > div > div.form-control-wrap > div > input';
     $I->fillField($pageTitle, 'Testpage');
     $I->click($saveButton);
     $I->waitForElement($pageTitle);
     $I->assertEquals('Testpage', $I->grabValueFrom($pageTitle), 'Value in input field.');
     $I->switchToIFrame();
     // Check tree
     $I->waitForElement($typo3NavigationContainer);
     $pageInTree = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > a > span';
     $I->assertEquals('Testpage', $I->grabTextFrom($pageInTree), 'Value in tree.');
     // And delete page from tree
     $pageInTreeIcon = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > span.t3js-icon.icon.icon-size-small.icon-state-default.icon-apps-pagetree-page-default';
     $pageActions = '#typo3-pagetree-contextmenu > ul > li:nth-child(8) > a > span.x-menu-item-text';
     $delete = '#typo3-pagetree-contextmenu-sub1 > ul > li:nth-child(6) > a > span.x-menu-item-text';
     $I->click($pageInTreeIcon);
     $I->waitForElement('#typo3-pagetree-contextmenu');
     $I->waitForElement($pageActions);
     $I->moveMouseOver($pageActions);
     $I->waitForElement('#typo3-pagetree-contextmenu-sub1');
     $I->click($delete);
     $yesButtonPopup = '#main > div.x-window.x-window-plain.x-window-dlg > div.x-window-bwrap > div.x-window-bl > div > div > div > div.x-panel-fbar.x-small-editor.x-toolbar-layout-ct > table > tbody > tr > td.x-toolbar-left > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(2) > td.x-btn-mc > em > button';
     $I->waitForElement($yesButtonPopup);
     $I->click($yesButtonPopup);
     $I->wait(2);
     $I->cantSee('Testpage');
 }
 /**
  * @param Admin $I
  */
 public function _before(Admin $I)
 {
     $I->useExistingSession();
     // clear the localstorage to fix problems in phantomJs where the search
     // sometimes is preserved over multiple sessions
     $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) {
         $webDriver->executeScript('localStorage.clear();');
     });
     $I->click('Extensions', '#typo3-module-menu');
     $I->switchToIFrame('content');
     $I->waitForElementVisible('#typo3-extension-list');
 }