Example usage for org.openqa.selenium By cssSelector

List of usage examples for org.openqa.selenium By cssSelector

Introduction

In this page you can find the example usage for org.openqa.selenium By cssSelector.

Prototype

public static By cssSelector(String cssSelector) 

Source Link

Document

Find elements via the driver's underlying W3C Selector engine.

Usage

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Click on the Phisician icon on the LabClient list page for West lab$")
public void click_on_the_Phisician_icon_on_the_LabClient_list_page_for_West_lab() throws Throwable {
    Thread.sleep(2000);//from   w  ww. j  a  v a  2 s  . c  o  m

    WebElement table = driver.findElement(By.id("example"));

    List<WebElement> allRows = table.findElements(By.tagName("tr"));
    loop: {
        for (WebElement row : allRows) {
            List<WebElement> cells = row.findElements(By.xpath("./*"));
            for (WebElement cell : cells) {
                String cellText = cell.getText();
                if (cellText.equals(LAB_CLIENT)) {
                    WebElement icon = row.findElement(By.cssSelector(".fa.fa-user-md.fa-2x"));
                    icon.click();
                    break loop;
                }
            }
        }
    }
    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Select 'Edit' icon next to 'Angelina' physician$")
public void select_Edit_icon_next_to_Angelina_physician() throws Throwable {
    Thread.sleep(2000);// ww w  . j  a v a  2  s. c  om

    WebElement table = driver.findElement(By.id("example"));
    List<WebElement> allRows = table.findElements(By.tagName("tr"));
    loop: {
        for (WebElement row : allRows) {
            List<WebElement> cells = row.findElements(By.xpath("./*"));
            for (WebElement cell : cells) {
                String cellText = cell.getText();
                if (cellText.equals("Angelia")) {
                    WebElement icon = row.findElement(By.cssSelector(".fa.fa-pencil-square-o.fa-2x"));
                    icon.click();
                    break loop;
                }
            }
        }
    }
    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Select Lab Client Locations as 'West' and select Location as 'West' and add the location$")
public void select_Lab_Client_Locations_as_West_and_select_Location_as_West_and_add_the_location()
        throws Throwable {

    Select dropdown = new Select(driver.findElement(By.id("labclientselect")));
    dropdown.selectByVisibleText(LAB_CLIENT);
    Thread.sleep(1000);/*from  w w w  .j  av  a 2 s .  co  m*/
    dropdown = new Select(driver.findElement(By.id("lablocations")));
    dropdown.selectByVisibleText(LAB_CLIENT);

    driver.findElement(By.cssSelector(".addLocation")).click();

    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Click on 'Submit'$")
public void click_on_Submit() throws Throwable {
    driver.findElement(By.cssSelector(".btn.btn-danger.btn-md")).click();
    Thread.sleep(2000);//  w  w w  .j a  v a 2s.  c om
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@Then("^Physician should be added to the West Lab Client$")
public void physician_should_be_added_to_the_West_Lab_Client() throws Throwable {
    Thread.sleep(1000);/*  w ww.j  av  a  2 s. co m*/
    driver.findElement(By.cssSelector(".alert.alert-success"));
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Click on the Phisician icon on the LabClient list page for Zest lab$")
public void click_on_the_Phisician_icon_on_the_LabClient_list_page_for_Zest_lab() throws Throwable {
    Thread.sleep(2000);/*  ww  w  .j a va  2 s  . c  om*/

    WebElement table = driver.findElement(By.id("example"));

    List<WebElement> allRows = table.findElements(By.tagName("tr"));
    loop: {
        for (WebElement row : allRows) {
            List<WebElement> cells = row.findElements(By.xpath("./*"));
            for (WebElement cell : cells) {
                String cellText = cell.getText();
                if (cellText.equals(LAB_CLIENT)) {
                    WebElement icon = row.findElement(By.cssSelector(".fa.fa-user-md.fa-2x"));
                    icon.click();
                    break loop;
                }
            }
        }
    }
    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Select 'Edit' icon next to 'BradLemon' physician$")
public void select_Edit_icon_next_to_BradLemon_physician() throws Throwable {
    Thread.sleep(2000);//from w w  w. j  ava  2s  . co  m

    WebElement table = driver.findElement(By.id("example"));
    List<WebElement> allRows = table.findElements(By.tagName("tr"));
    loop: {
        for (WebElement row : allRows) {
            List<WebElement> cells = row.findElements(By.xpath("./*"));
            for (WebElement cell : cells) {
                String cellText = cell.getText();
                if (cellText.equals("BradLemon")) {
                    WebElement icon = row.findElement(By.cssSelector(".fa.fa-pencil-square-o.fa-2x"));
                    icon.click();
                    break loop;
                }
            }
        }
    }
    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@When("^Select Lab Client Locations as 'Zest' and select Location as 'Zest' and add the location$")
public void select_Lab_Client_Locations_as_Zest_and_select_Location_as_Zest_and_add_the_location()
        throws Throwable {
    Select dropdown = new Select(driver.findElement(By.id("labclientselect")));
    dropdown.selectByVisibleText(LAB_CLIENT);
    Thread.sleep(1000);/*from w  w  w.j a  v a2 s .  c  o  m*/
    dropdown = new Select(driver.findElement(By.id("lablocations")));
    dropdown.selectByVisibleText(LAB_CLIENT);

    driver.findElement(By.cssSelector(".addLocation")).click();

    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java

@Then("^Physician should be added to the Zest Lab Client$")
public void physician_should_be_added_to_the_Zest_Lab_Client() throws Throwable {
    Thread.sleep(1000);//ww w.j a v  a  2s . c o m
    driver.findElement(By.cssSelector(".alert.alert-success"));
}

From source file:com.easytox.automation.steps.AuditAndUserLogImpl.java

@When("^In User log click on down arrow icon  on (.*)$")
public void in_user_log_click_on_down_arrow_icon(String column) {
    if (column.equals("User Name")) {
        MyWebDriverUtils.waitContainerThenClick(driver, SORT_ASCENDING_LOCATOR, LocatorType.CSS);
    }//from w  w  w . j  a v a2 s.  co  m
    String locator = getLocator(column);

    if (column.equals("Case Acc#") && locator != null) {
        driver.findElement(By.cssSelector(locator)).sendKeys(Keys.ENTER);
    } else {
        MyWebDriverUtils.waitContainerThenClick(driver, locator, LocatorType.CSS);
    }
}