Id’s Type casting Selenium

public By idReturn(String id){
id = id.toLowerCase();
if(id.startsWith(“id~”)) return“id~”, “”));
else if(id.startsWith(“name~”)) return“name~”, “”));
else if(id.startsWith(“cssselector~”)) return By.cssSelector(id.replace(“cssselector~”,    “”));
else if(id.startsWith(“xpath~”)) return By.xpath(id.replace(“xpath~”, “”));

return By.xpath(“Unable to find the element locater”);

public boolean enterText(String id, String value){
if(value.length() == 0) return false;
return true;
public void clickElement(String id){

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s