RE: Interview Question

I have a textbox, button and a lable.

The requirement is, If I enter any text color (ex: green) and click the button. Then the lable shall fill the color with green.

Depending upon the color entering in the textbox, the lable shall fill with that respective color.

Can anybody let me know the Selenium WebDriver code in Java.

Add Comment
3 Answers

String str = “green”;
driver.findElement(By.id(“textbox”)).sendkeys(str);
driver.findElement(By.id(“button”)).click();
String strx = ┬ádriver.findElement(By.id(“lable”)).getCSSValue(“background-color”);
if (str.equals(strx)){
// test case passed
}

Supporter Answered on July 21, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.