The HTML code is
//<input name="input" class="form-text required error" id="edit-input" type="text" size="20" maxLength="255"/>
//<input name="op" class="form-submit" id="edit-submit-1" type="submit" value="Submit"/>
The Code example to check the above behavior is
@Test
public void iscolorchanged() {
org.openqa.selenium.ie.InternetExplorerDriver driver = new org.openqa.selenium.ie.InternetExplorerDriver();
driver.get("the url to test");
WebElement submitbutton = (new WebDriverWait(driver, 10)).until(new ExpectedCondition<WebElement>(){
@Override
public WebElement apply(WebDriver d) {
return d.findElement(By.xpath("//*[@id='edit-submit-1' and @name='op']"));
}});
submitbutton.submit();
WebElement inputbox = (new WebDriverWait(driver, 10)).until(new ExpectedCondition<WebElement>(){
@Override
public WebElement apply(WebDriver d) {
return d.findElement(By.xpath("//*[@id='edit-input'and @class='form-text required error']"));
}});
Boolean colorchanged;
String color= inputbox.getCssValue("border-color");
if(color.equals("#ff0000"))
{
colorchanged=true;
}
else
{
colorchanged=false;
}
System.out.println( colorchanged);
}
Gathered from Net
how to verify the font colour of an element or text using selenium RC..?
ReplyDeletehow to verify the background colour of an element using selenium RC..?
how to verify the selection of tab in the webpage using selenium RC..?
There are 5 tabs in the webpage, in that "Home" tab need to be select by default while opening the page.so for that i need solution for anyone of the above questions