List of usage examples for org.openqa.selenium.support.ui WebDriverWait WebDriverWait
public WebDriverWait(WebDriver driver, Duration timeout)
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Make changes as needed and click update$") public void make_changes_as_needed_and_click_update() { WebElement address1 = MyWebDriverUtils.findElement(driver, ADDRESS_1_LOCATOR, LocatorType.NAME); if (address1 != null) { address1.clear();/*from ww w.j ava 2 s . c o m*/ address1.sendKeys(ADDRESS_1_VALUE); } else { Assert.fail("address1 is null!"); } WebElement address2 = MyWebDriverUtils.findElement(driver, ADDRESS_2_LOCATOR, LocatorType.NAME); if (address2 != null) { address2.clear(); address2.sendKeys(ADDRESS_2_VALUE); } else { Assert.fail("address2 is null!"); } WebElement faxNumber = MyWebDriverUtils.findElement(driver, FAX_NUMBER_LOCATOR, LocatorType.NAME); if (faxNumber != null) { faxNumber.clear(); faxNumber.sendKeys(FAX_NUMBER_VALUE); } else { Assert.fail("faxNumber is null!"); } WebElement submit = MyWebDriverUtils.findElement(driver, SUBMIT_BUTTON_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) { checkAndClick(submit); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Click '\\+' icon against updated lab client$") public void click_plus_icon_against_updated_lab_client() { final WebElement table = MyWebDriverUtils.findElement(driver, TABLE_LOCATOR, LocatorType.ID); if (table != null) { List<WebElement> listRows = MyWebDriverUtils.findElements(driver, ROWS_LOCATOR, LocatorType.TAG, table); if (listRows != null) { List<WebElement> listCells = MyWebDriverUtils.findElements(driver, CELL_LOCATOR, LocatorType.TAG, listRows.get(1));//w ww. j av a 2 s .c o m if (listCells != null && listCells.size() == 9) { WebElement el = listCells.get(0); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) { checkAndClick(el); } else { Assert.fail("flag is false!"); } } else { throw new StaleElementReferenceException("listCells size is not equal 9"); } } else { Assert.fail("listRows is null!"); } } else { Assert.fail("table is null!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Click on the location Icon in the editPage$") public void click_on_the_location_icon_in_the_edit_page() { WebElement el = MyWebDriverUtils.findElement(driver, ADD_LOCATION_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) {//from ww w . jav a2 s .co m checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Enter Location Name and the remaining details and click on 'Submit'$") public void enter_location_name_and_the_remaining_details_and_click_on_submit() { WebElement labName = MyWebDriverUtils.findElement(driver, LAB_LOCATION_NAME_LOCATOR, LocatorType.NAME); if (labName != null) { labName.clear();//ww w .j av a2s . co m labName.sendKeys(LAB_LOCATION_NAME_VALUE); } else { Assert.fail("labName is null!"); } WebElement labDepartment = MyWebDriverUtils.findElement(driver, LAB_LOCATION_DEPARTMENT_LOCATOR, LocatorType.NAME); if (labDepartment != null) { labDepartment.clear(); labDepartment.sendKeys(LAB_LOCATION_DEPARTMENT_VALUE); } else { Assert.fail("labDepartment is null!"); } WebElement labAddress = MyWebDriverUtils.findElement(driver, LAB_LOCATION_ADDRESS_LOCATOR, LocatorType.NAME); if (labAddress != null) { labAddress.clear(); labAddress.sendKeys(LAB_LOCATION_ADDRESS_VALUE); } else { Assert.fail("labAddress is null!"); } WebElement faxNumber = MyWebDriverUtils.findElement(driver, FAX_NUMBER_LOCATOR, LocatorType.NAME); if (faxNumber != null) { faxNumber.clear(); faxNumber.sendKeys(FAX_NUMBER_VALUE); } else { Assert.fail("faxNumber is null!"); } WebElement el = MyWebDriverUtils.findElement(driver, EDIT_SUBMIT_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) { checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Click on the Location icon for a lab client") public void click_on_the_location_icon_for_a_lab_client() { WebElement el = MyWebDriverUtils.findElement(driver, LOCATION_LIST_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) {/*w ww. ja va2 s. c om*/ checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Click on the Edit icon for a lab location$") public void click_on_the_edit_icon_for_a_lab_location() { WebElement el = MyWebDriverUtils.findElement(driver, EDIT_ICON_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) {//w w w . j ava 2s . com checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Make required changes and click Update$") public void make_required_changes_and_click_update() { WebElement labName = MyWebDriverUtils.findElement(driver, LAB_LOCATION_NAME_LOCATOR, LocatorType.NAME); if (labName != null) { labName.clear();//w w w . j av a2 s. c o m labName.sendKeys(LAB_LOCATION_NAME_VALUE); } else { Assert.fail("labName is null!"); } WebElement labDepartment = MyWebDriverUtils.findElement(driver, LAB_LOCATION_DEPARTMENT_LOCATOR, LocatorType.NAME); if (labDepartment != null) { labDepartment.clear(); labDepartment.sendKeys(LAB_LOCATION_DEPARTMENT_VALUE); } else { Assert.fail("labDepartment is null!"); } WebElement labAddress = MyWebDriverUtils.findElement(driver, LAB_LOCATION_ADDRESS_LOCATOR, LocatorType.NAME); if (labAddress != null) { labAddress.clear(); labAddress.sendKeys(LAB_LOCATION_ADDRESS_VALUE); } else { Assert.fail("labAddress is null!"); } WebElement faxNumber = MyWebDriverUtils.findElement(driver, FAX_NUMBER_LOCATOR, LocatorType.NAME); if (faxNumber != null) { faxNumber.clear(); faxNumber.sendKeys(FAX_NUMBER_VALUE); } else { Assert.fail("faxNumber is null!"); } WebElement el = MyWebDriverUtils.findElement(driver, UPDATE_SUBMIT_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) { checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Click on the Add User Icon$") public void click_on_the_add_user_icon() { WebElement el = MyWebDriverUtils.findElement(driver, ADD_USER_ICON_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) {/*from w w w . j av a 2s.c om*/ checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Enter User information, Personal information and select lab information. click on 'Submit'$") public void enter_information_and_submit() throws InterruptedException { Thread.sleep(TIME_STOP);/* w ww . j a v a 2s . c o m*/ WebElement userName = MyWebDriverUtils.findElement(driver, USER_USERNAME_LOCATOR, LocatorType.NAME); if (userName != null) { userNameValue = StringUtils.generateRandom(); userName.clear(); userName.sendKeys(userNameValue); } else { Assert.fail("userName is null!"); } WebElement password = MyWebDriverUtils.findElement(driver, USER_PASSWORD_LOCATOR, LocatorType.NAME); if (password != null) { password.clear(); password.sendKeys(USER_PASSWORD_VALUE); } else { Assert.fail("password is null!"); } WebElement firstName = MyWebDriverUtils.findElement(driver, USER_FIRST_NAME_LOCATOR, LocatorType.CSS); if (firstName != null) { firstName.clear(); firstName.sendKeys(USER_FIRST_NAME_VALUE); } else { Assert.fail("firstName is null!"); } WebElement lastName = MyWebDriverUtils.findElement(driver, USER_LAST_NAME_LOCATOR, LocatorType.CSS); if (lastName != null) { lastName.clear(); lastName.sendKeys(USER_LAST_NAME_VALUE); } else { Assert.fail("lastName is null!"); } WebElement email = MyWebDriverUtils.findElement(driver, USER_EMAIL_LOCATOR, LocatorType.NAME); if (email != null) { email.clear(); email.sendKeys(USER_EMAIL_VALUE); } else { Assert.fail("email is null!"); } WebElement phoneNumber = MyWebDriverUtils.findElement(driver, USER_PHONE_NUMBER_LOCATOR, LocatorType.NAME); if (phoneNumber != null) { phoneNumber.clear(); phoneNumber.sendKeys(USER_PHONE_NUMBER_VALUE); } else { Assert.fail("phoneNumber is null!"); } new Select(driver.findElement(By.cssSelector(SELECT_ROLE_LOCATOR))).selectByVisibleText(ROLE); new Select(driver.findElement(By.id(LAB_LOCATIONS_LOCATOR))).selectByVisibleText(LAB_LOCATIONS_VALUE); WebElement el = MyWebDriverUtils.findElement(driver, USER_SUBMIT_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) { checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Click on the User icon for a lab client$") public void click_on_the_user_icon_for_a_lab_client() { WebElement el = MyWebDriverUtils.findElement(driver, USER_ICON_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) {//w ww . j a v a 2 s. com checkAndClick(el); } else { Assert.fail("flag is false!"); } }