List of usage examples for org.openqa.selenium WebElement click
void click();
From source file:com.cisco.dbds.utils.primewidgets.primewidgetsStepDef.java
License:Open Source License
@Then("^Select checkboxes corresponding to locked row \"(.*?)\" at \"(.*?)\"$") public void click_checkboxes_for_locked_rows_at_top(List<String> rows, String position) throws NoSuchMethodException, SecurityException, ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { LogHandler.info("click_checkboxes_for_locked_rows_at_top(List<String> rows,String position)"); try {/*from w ww . j a va2 s . co m*/ if (position.equals("top")) { for (String row : rows) { List<WebElement> wes = new ArrayList<WebElement>(); wes = SeleniumUtilities.findElements(Identifier.XPATH, String.format(ROW_TOPLOCKED_CHECKBOX, row)); for (WebElement we : wes) { System.out.println("hi"); we.click(); } } } else if (position.equals("bottom")) { for (String row : rows) { List<WebElement> wes = new ArrayList<WebElement>(); wes = SeleniumUtilities.findElements(Identifier.XPATH, String.format(ROW_BOTTOMLOCKED_CHECKBOX, row)); for (WebElement we : wes) { System.out.println("hi"); we.click(); } } } } catch (WebDriverException e) { Assert.assertTrue("Page object mimsatch for ROW_LOCKED_CHECKBOX at " + position, false); } }
From source file:com.cisco.dbds.utils.primewidgets.primewidgetsStepDef.java
License:Open Source License
@Given("Select checkboxes corresponding to column names \"(.*?)\"") public void select_checkbox_corresponding_to_columnnames(List<String> columns) throws NoSuchMethodException, SecurityException, ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { LogHandler.info("select_checkbox_corresponding_to_columnnames(List<String> columns)"); try {//from ww w . j a v a 2 s . c o m for (String column : columns) { List<WebElement> wes = new ArrayList<WebElement>(); wes = SeleniumUtilities.findElements(Identifier.XPATH, String.format(CHECKBOXES_TO_SELECT, column)); for (WebElement we : wes) { System.out.println("hi"); we.click(); } } } catch (WebDriverException e) { Assert.assertTrue("CHECKBOXES_TO_SELECT page object mismatch", false); } }
From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java
License:Open Source License
/** * Nvigate to URL.//from ww w .ja v a 2 s . c o m * * @param url * the url */ public static void navigateToUrl(String url) { driver.get(url); String browser = Validate.readsystemvariable("browser"); if (browser.equals("IE")) { WebDriverWait wait = new WebDriverWait(driver, 10); WebElement ele = wait.until(ExpectedConditions.elementToBeClickable( driver.findElement(By.linkText("Continue to this website (not recommended).")))); ele.click(); } // driver.get(driver.getCurrentUrl()); }
From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java
License:Open Source License
/** * Performs a click on the Webelement./*from w w w . j av a 2 s.co m*/ * * @param element * the element */ public static void click(WebElement element) { // SeleniumUtilities.waitForElement(element); element.click(); }
From source file:com.citrix.g2w.webdriver.pages.BasePage.java
License:Open Source License
/** * Method to set the check box values.//from www . j a va 2s . c o m * * @param checkBoxElement * (element of check box) * @param check * (boolean to select check box) */ public void setCheckBox(final WebElement checkBoxElement, final boolean check) { boolean isChecked = checkBoxElement.isSelected(); if ((isChecked && !check) || (!isChecked && check)) { checkBoxElement.click(); } }
From source file:com.citrix.g2w.webdriver.pages.forms.SurveyForm.java
License:Open Source License
/** * Method to Select the Multiple Choice with One Answer Set the inputs to * the fields.//from w w w .ja v a 2 s . c o m * * @param question * (question) * @param listOfanswers * (list of answers) */ public void addMultipleChoiceQuestionWithOneAnswer(final String question, final List<String> listOfanswers) { this.logger.log("Add Multiple Choic Question with Single answer: " + question); // click on questionType this.questionTypes.click(); findVisibleElement( By.xpath("//div[@id='questionTypes__menu']/ul/li[contains(., 'Multiple Choice with One Answer')]"), 30); WebElement questionType = driver.findElement( By.xpath("//div[@id='questionTypes__menu']/ul/li[contains(., 'Multiple Choice with One Answer')]")); questionType.click(); this.enterQuestionsAndAnswers(question, listOfanswers); // click on create question this.findClickableElement(By.id("createQuestion")).click(); this.logger.logWithScreenShot("Added question to Survey :" + question, this.driver); }
From source file:com.citrix.g2w.webdriver.pages.forms.SurveyForm.java
License:Open Source License
/** * Method toSelect the Multiple Choice with multiple Answers Set the inputs * to the fields.//from ww w. java 2 s.c o m * * @param question * (question) * @param listOfanswers * (list of answers) */ public void addNewMultipleAnswersQuestionsToSurvey(final String question, final List<String> listOfanswers) { this.logger.log("Add Multiple Choice with multiple answers question: " + question); // click on questionType this.questionTypes.click(); findVisibleElement(By.xpath( "//div[@id='questionTypes__menu']/ul/li[contains(., 'Multiple Choice with Multiple Answer')]"), 30); WebElement questionType = driver.findElement(By.xpath( "//div[@id='questionTypes__menu']/ul/li[contains(., 'Multiple Choice with Multiple Answers')]")); questionType.click(); this.enterQuestionsAndAnswers(question, listOfanswers); // click on create question this.findClickableElement(By.id("createQuestion")).click(); this.logger.logWithScreenShot("Added question to Survey :", this.driver); }
From source file:com.citrix.g2w.webdriver.pages.forms.SurveyForm.java
License:Open Source License
/** * Method to Select the Rating on a scale Set the inputs to the fields. * //from ww w.j a va 2s. c o m * @param question * (question) */ public void addRatingScaleQuestion(final String question) { this.logger.log("Add Rating Scale Question " + question); // click on questionType this.questionTypes.click(); findVisibleElement( By.xpath("//div[@id='questionTypes__menu']/ul/li[contains(., 'Rate on a Scale of 1 to 5')]"), 30); WebElement questionType = driver.findElement( By.xpath("//div[@id='questionTypes__menu']/ul/li[contains(., 'Rate on a Scale of 1 to 5')]")); questionType.click(); if (question != null) { this.newQuestionText.sendKeys(question); } // click on create question this.findClickableElement(By.id("createQuestion")).click(); this.logger.logWithScreenShot("Added question to Survey :", this.driver); }
From source file:com.citrix.g2w.webdriver.pages.forms.SurveyForm.java
License:Open Source License
/** * Method to Select the short answer Set the inputs to the fields. * /*from www . j av a 2 s . co m*/ * @param question * (question) */ public void addShortAnswerQuestion(final String question) { this.logger.log("Add Short Answer Question: " + question); // click on questionType this.questionTypes.click(); findVisibleElement(By.xpath("//div[@id='questionTypes__menu']/ul/li[contains(., 'Short Answer')]"), 30); WebElement questionType = driver .findElement(By.xpath("//div[@id='questionTypes__menu']/ul/li[contains(., 'Short Answer')]")); questionType.click(); if (question != null) { this.newQuestionText.sendKeys(question); } // click on create question this.findClickableElement(By.id("createQuestion")).click(); this.logger.logWithScreenShot("Added question to Survey :", this.driver); }
From source file:com.citrix.g2w.webdriver.pages.managewebinar.ManageFollowUpEmailPage.java
License:Open Source License
/** * Method used to select a recording attachment for follow up email * /*from ww w . j a v a2 s. com*/ * @param recordingFileId * Id of recording file */ public void attachRecording(String recordingFileId) { if (StringUtils.isNotBlank(recordingFileId)) { WebElement selectRecordingLink = this.driver.findElement(By.id("selectRecordingButton")); selectRecordingLink.click(); WebElement recordingFileSelection = this.driver .findElement(By.id("offlineWebinarKey_" + recordingFileId)); recordingFileSelection.click(); WebElement attachRecordingButton = this.driver .findElement(By.xpath("//div[@id='attachRecording']/div[1]/div[1]/button")); attachRecordingButton.click(); logger.logWithScreenShot("attached file", this.driver); } }