You are on page 1of 2

import org.openqa.selenium.

*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;//Add required imports

public class CSSLocator//DO NOT change the class name


{
String fname;
static WebDriver driver;
public WebDriver createDriver() //DO NOT change the method signature
{
driver=DriverSetup.getWebDriver();
return driver;
//Implement code to create Driver from DriverSetup and return it
}

public WebElement getCSSLocator(WebDriver driver) //DO NOT change the method


signature
{
WebElement element=driver.findElement(By.cssSelector("#username"));
return element;
/*Replace this comment by the code statement to get the Web element of username*/
/*Find and return the element */

public String getName(WebElement element) //DO NOT change the method signature
{
String fname=element.getAttribute("placeholder");
return fname;

//Get the attribute value from the element and return it


}

public static void main(String[] args){


CSSLocator pl=new CSSLocator();
driver=pl.createDriver();
WebElement element=pl.getCSSLocator(driver);
String hi=pl.getName(element);
//Add required code

}
}

You might also like