/*
         * Enter text in a search box and clicks on search button if there is one
         */

        void IActionsVisitor.visitSearch(ArcliteSearch arcliteSearch, InputVal wanted)
        {
            if (arcliteSearch._searchButtonXpath == null)
            {
                IArcliteWebElement search = new ArcliteTextBox("", arcliteSearch._searchInputXPath);
                search.accept(this, wanted);
                IWebElement webElement;
                webElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(search.elementXPath)));
                webElement.SendKeys(Keys.Enter);
            }
            else
            {
                IArcliteWebElement search = new ArcliteTextBox("", arcliteSearch._searchInputXPath);
                search.accept(this, wanted);
                IArcliteWebElement confirm = new ArcliteButton("", arcliteSearch._searchButtonXpath);
                confirm.accept(this, new InputVal());
            }
        }
        //Dictionary<element name, XPath>
        private void initPage()
        {
            elementXpaths = new Dictionary <string, IArcliteWebElement>();

            IArcliteWebElement approveRequestConfirm = new ArcliteButton("Workstation Submit Delete", "//button[@id='btnDelete']");
            IArcliteWebElement approveRequestCancel  = new ArcliteButton("Workstation Cancel Delete", "//button[@id='btnDelete']/parent::div/button[@title='No']");
            IArcliteWebElement search = new ArcliteSearch("Workstation Ongoing Search", "//input[@id='textSrchWrkflwName']", "//button[@id='anchSearchJobs']");

            ongoing   = new KeyValuePair <string, IArcliteWebElement>("Workstation Ongoing", new ArcliteButton("Workstation Ongoing", "//a[@id='aOngoingTab']"));
            completed = new KeyValuePair <string, IArcliteWebElement>("Workstation Completed", new ArcliteButton("Workstation Completed", "//a[@id='aCompletedTab']"));
            ongoingWorkstationTable   = new KeyValuePair <string, IArcliteWebElement>("Workstation Ongoing Table", new ArcliteDataTable("Workstation Ongoing Table", search, "//td[text()='", "']", "", null, null));
            search.elementName        = "Workstation Compelted Search";
            completedWorkstationTable = new KeyValuePair <string, IArcliteWebElement>("Workstation Completed Table", new ArcliteDataTable("Workstation Completed Table", search, "//td[text()='", "']", "/parent::tr/td/div/a", null, null));

            search      = new ArcliteSearch("Workstation Step Search", "//div[@id='tblSteps_filter']/label/input", null);
            stepsTable  = new KeyValuePair <string, IArcliteWebElement>("Workstation Steps Table", new ArcliteDataTable("Workstation Steps Table", search, "//td[text()='", "']", "", null, null));
            start       = new KeyValuePair <string, IArcliteWebElement>("Workstation Step Start", new ArcliteButton("Workstation Step Start", "//button[@id='timerPlay']"));
            pause       = new KeyValuePair <string, IArcliteWebElement>("Workstation Step Pause", new ArcliteButton("Workstation Step Pause", "//button[@id='timerPause']"));
            complete    = new KeyValuePair <string, IArcliteWebElement>("Workstation Step Complete", new ArcliteButton("Workstation Step Complete", "//button[@id='timerStop']"));
            instruction = new KeyValuePair <string, IArcliteWebElement>("Workstation Instruction", new ArcliteButton("Workstation Instruction", "//button[@data-menu-name='Instructions']"));

            personnel = new KeyValuePair <string, IArcliteWebElement>("Workstation Personnel", new ArcliteButton("Workstation Personnel", "//button[@data-menu-name='Personnel']"));
            asset     = new KeyValuePair <string, IArcliteWebElement>("Workstation Equipments", new ArcliteButton("Workstation Equipments", "//button[@data-menu-name='Equipments']"));
            equiment  = new KeyValuePair <string, IArcliteWebElement>("Workstation Output", new ArcliteButton("Workstation Output", "//button[@data-menu-name='Output']"));
            checklist = new KeyValuePair <string, IArcliteWebElement>("Workstation Parameters Input", new ArcliteButton("Workstation Parameters Input", "//button[@data-menu-name='Parameters Input']"));
            /*notReady*/
            producedGoodsQuality = new KeyValuePair <string, IArcliteWebElement>("Workstation Produced Goods Quality", new ArcliteButton("Workstation Produced Goods Quality", "//label[@for='chkIsLastStep']"));

            /*notReady*/
            numberOfGoodsToBeProduced = new KeyValuePair <string, IArcliteWebElement>("Workstation Number Of Good To Be Produced", new ArcliteTextBox("Workstation Number Of Good To Be Produced", "//button[@title='Instructions']"));

            /*notReady*/
            goodsProduceAreEfficient = new KeyValuePair <string, IArcliteWebElement>("Workstation Goods Produce Are Efficent", new ArcliteTextBox("Workstation Goods Produce Are Efficent", "//input[@id='txtInstructionName']"));
            attachment = new KeyValuePair <string, IArcliteWebElement>("Workstation Attachments", new ArcliteButton("Workstation Attachments", "//button[@data-menu-name='Attachments']"));
            backToStep = new KeyValuePair <string, IArcliteWebElement>("Workstation Back To Step", new ArcliteButton("Workstation Back To Step", "//button[@onclick='goBackTostepPage()']"));
            back       = new KeyValuePair <string, IArcliteWebElement>("Workstation Back", new ArcliteButton("Workstation Back To Step", "//button[@id='btnBack']"));
        }
        //Dictionary<element name, XPath>
        private void initPage()
        {
            elementXpaths = new Dictionary <string, IArcliteWebElement>();

            IArcliteWebElement approveRequestConfirm = new ArcliteButton("Workflow Submit Delete", "//button[@id='btnDelete']");
            IArcliteWebElement approveRequestCancel  = new ArcliteButton("Workflow Cancel Delete", "//button[@id='btnDelete']/parent::div/button[@title='No']");
            IArcliteWebElement search = new ArcliteSearch("WorkFlow Search", "//div[@id='tbWorkflows_filter']/label/input", null);

            workflowTable = new KeyValuePair <string, IArcliteWebElement>("Workflow Data Table", new ArcliteDataTable("Workflow Data Table", search, "//div[text()='", "']", "/parent::td/parent::tr/td/button[@title='Delete']", approveRequestConfirm, approveRequestCancel));
            add           = new KeyValuePair <string, IArcliteWebElement>("Workflow Add", new ArcliteButton("Workflow Add", "//a[@title='Add Workflow']"));
            workflowName  = new KeyValuePair <string, IArcliteWebElement>("Workflow Name", new ArcliteTextBox("Workflow Name", "//input[@id='txtWorkflowName']"));
            description   = new KeyValuePair <string, IArcliteWebElement>("Workflow Description", new ArcliteTextBox("Workflow Description", "//textarea[@id='txtDescription']"));

            AddWorkFlowSave        = new KeyValuePair <string, IArcliteWebElement>("Workflow Save", new ArcliteButton("Workflow Save", "//a[@onclick='updateWorkflow(this)']"));
            AddWorkFlowCancel      = new KeyValuePair <string, IArcliteWebElement>("Workflow Cancel", new ArcliteButton("Workflow Cancel", "//a[@onclick='updateWorkflow(this)']/parent::div/button"));
            FinishBuildingWorkFlow = new KeyValuePair <string, IArcliteWebElement>("Workflow Finish Building", new ArcliteButton("Workflow Finish Building", "//a[@id='btnSaveWorkflow']"));
            addStep = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Step", new ArcliteButton("Workflow Add Step", "//div[@id='btngrpElements']/a[@onclick='createStep()']"));
            canvas  = new KeyValuePair <string, IArcliteWebElement>("Workflow Canvas", new ArcliteCanvas("Workflow Canvas", "//div[@id='wfCanvas']", addStep.Value));

            stepName  = new KeyValuePair <string, IArcliteWebElement>("Workflow Step Name", new ArcliteTextBox("Workflow Step Name", "//input[@id='txtStepName']"));
            runTime   = new KeyValuePair <string, IArcliteWebElement>("Workflow Run Time", new ArcliteTextBox("Workflow Run Time", "//input[@id='txtRuntime']"));
            cycleTime = new KeyValuePair <string, IArcliteWebElement>("Workflow Cycle Time", new ArcliteTextBox("Workflow Cycle Time", "//input[@id='txtCycletime']"));
            startStep = new KeyValuePair <string, IArcliteWebElement>("Workflow Start Step", new ArcliteButton("Workflow Start Step", "//label[@for='chkIsStartStep']"));
            lastStep  = new KeyValuePair <string, IArcliteWebElement>("Workflow Last Step", new ArcliteButton("Workflow Last Step", "//label[@for='chkIsLastStep']"));

            instruction     = new KeyValuePair <string, IArcliteWebElement>("Workflow Step Instruction", new ArcliteTextBox("Workflow Step Instruction", "//button[@title='Instructions']"));
            instructionName = new KeyValuePair <string, IArcliteWebElement>("Workflow Instruction Name", new ArcliteTextBox("Workflow Instruction Name", "//input[@id='txtInstructionName']"));
            instructionType = new KeyValuePair <string, IArcliteWebElement>("Workflow Instruction Type", new ArcliteSelect("Workflow Instruction Type", "//select[@id='ddlInstructionType']", "//select[@id='ddlInstructionType']"));
            attachment      = new KeyValuePair <string, IArcliteWebElement>("Workflow Instruction Attachment", new ArcliteAttachment("Workflow Instruction Attachment", "//input[@id='arc-file']"));
            instructionSave = new KeyValuePair <string, IArcliteWebElement>("Workflow Instruction Save", new ArcliteButton("Workflow Instruction Save", "//button[@onclick='updateInstruction(1)']"));

            search = new ArcliteSearch("Workflow Personnel Qualification Search", "//input[@aria-controls='tbQualification']", null);

            instructionCancel           = new KeyValuePair <string, IArcliteWebElement>("Workflow Instruction Cancel", new ArcliteButton("Workflow Instruction Cancel", "//button[@onclick=\"resetForm('#Instruction')\"]"));
            personnel                   = new KeyValuePair <string, IArcliteWebElement>("Workflow Step Personnel", new ArcliteButton("Workflow Step Personnel", "//button[@title='Personnels']"));
            addPersonnelQualification   = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Personnel Qualifiction", new ArcliteButton("Workflow Add Personnel Qualifiction", "//button[@onclick='getQualification(1)']"));
            addPersonnel                = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Personnel", new ArcliteButton("Workflow Add Personnel", "//button[@onclick=\"getPersonnelSpecific('AllPersonnels')\"]"));
            personnelQualificationTable = new KeyValuePair <string, IArcliteWebElement>("Workflow Personnel Qualification Table", new ArcliteDataTable("Workflow Personnel Qualification Table", search, "//div[text()='", "']", "", null, null));

            search                    = new ArcliteSearch("Workflow Personnel Search", "//input[@aria-controls='tbPersonnelSpecifics']", null);
            personnelTable            = new KeyValuePair <string, IArcliteWebElement>("Workflow Personnel Table", new ArcliteDataTable("Workflow Personnel Table", search, "//td[text()='", "']", "", null, null));
            addMachineQualification   = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Machine Qualifiction", new ArcliteButton("Workflow Add Machine Qualifiction", "//button[@onclick='getAssetQualification(2)']"));
            addAsset                  = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Asset", new ArcliteButton("Workflow Add Asset", "//button[@onclick='getEquipementSpecific()']"));
            search                    = new ArcliteSearch("Workflow Machine Qualification Search", "//input[@aria-controls='tbQualification']", null);
            machineQualificationTable = new KeyValuePair <string, IArcliteWebElement>("Workflow Machine Qualification Table", new ArcliteDataTable("Workflow Machine Qualification Table", search, "//div[text()='", "']", "", null, null));
            search                    = new ArcliteSearch("Workflow Asset Search", "//input[@aria-controls='tbEquipnentSpecifics']", null);
            assetTable                = new KeyValuePair <string, IArcliteWebElement>("Workflow Asset Table", new ArcliteDataTable("Workflow Asset Table", search, "//div[text()='", "']", "", null, null));

            items      = new KeyValuePair <string, IArcliteWebElement>("Workflow Step Items", new ArcliteButton("Workflow Step Items", "//button[@title='Items']"));
            addItemIn  = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Item In", new ArcliteButton("Workflow Add Item In", "//button[@onclick='getResources(1)']"));
            addItemOut = new KeyValuePair <string, IArcliteWebElement>("Workflow Add Item Out", new ArcliteButton("Workflow Add Item Out", "//button[@onclick='getResources(2)']"));
            search     = new ArcliteSearch("Workflow Personnel Search", "//input[@aria-controls='tbResources']", null);
            itemsTable = new KeyValuePair <string, IArcliteWebElement>("Workflow Items Table", new ArcliteDataTable("Workflow Items Table", search, "//div[text()='", "']", "", null, null));
            checklists = new KeyValuePair <string, IArcliteWebElement>("Workflow Checklists", new ArcliteButton("Workflow Checklists", "//button[@title='Checklists']"));

            selectType    = new KeyValuePair <string, IArcliteWebElement>("Workflow Select Type", new ArcliteSelect("Workflow Select Type", "//select[@id='ddlChecklistType']", "//select[@id='ddlChecklistType']"));
            name          = new KeyValuePair <string, IArcliteWebElement>("Workflow Select Checklist Name", new ArcliteTextBox("Workflow Select Checklist Name", "//input[@id='txtChecklistName']"));
            notes         = new KeyValuePair <string, IArcliteWebElement>("Workflow Select Checklist Notes", new ArcliteTextBox("Workflow Select Checklist Notes", "//textarea[@id='txtNotes']"));
            expectedValue = new KeyValuePair <string, IArcliteWebElement>("Workflow Expected Value", new ArcliteTextBox("Workflow Expected Value", "//button[@title='Checklists']"));
            equipment     = new KeyValuePair <string, IArcliteWebElement>("Workflow Equipment", new ArcliteButton("Workflow Equipment", "//button[@title='Equipments']"));

            checklistSave   = new KeyValuePair <string, IArcliteWebElement>("Workflow Checklist Save", new ArcliteButton("Workflow Checklist Save", "//button[@onclick='updateChecklist(1)']"));
            checklistCancel = new KeyValuePair <string, IArcliteWebElement>("Workflow Checklist Cancel", new ArcliteButton("Workflow Checklist Cancel", "//button[@onclick='resetForm('#Checklist')']"));
            closeStep       = new KeyValuePair <string, IArcliteWebElement>("Workflow Close Step", new ArcliteButton("Workflow Close Step", "//span[@onclick='closeNav()']"));
        }