/** * Function that does Batch Process for Articles, Copy, Move articles * * @param string $articleName Article for which Batch Processing is to be done * @param string $searchString Value entered in the drop down to filter the results * @param string $newCategory Category to which the Article is to be moved or copied * @param string $action Action to be taken, either Move or Copy * * @return void */ public function doBatchAction($articleName, $searchString, $newCategory, $action) { $this->searchFor($articleName); $row = $this->getRowNumber($articleName); $this->driver->findElement(By::xPath("//input[@id='cb" . ($row - 1) . "']"))->click(); $this->clickButton('toolbar-batch'); $this->driver->waitForElementUntilIsPresent(By::xPath("//div[@class='modal hide fade in']")); $this->driver->findElement(By::xPath("//div[@id='batch_category_id_chzn']/a"))->click(); $this->driver->findElement(By::xPath("//div[@id='batch_category_id_chzn']/div/div/input"))->sendKeys($searchString); $this->driver->findElement(By::xPath("//div[@id='batch_category_id_chzn']//ul[@class = 'chzn-results']/li[contains(.,'" . $newCategory . "')]"))->click(); if (strtolower($action) == 'copy') { $this->driver->findElement(By::xPath("//input[@id='batch[move_copy]c']"))->click(); } else { $this->driver->findElement(By::XPath("//input[@id='batch[move_copy]m']"))->click(); } $this->driver->findElement(By::xPath("//button[contains(text(),'Process')]"))->click(); $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); }