import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class HDFCBank {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(5000, TimeUnit.SECONDS);
driver.get("http://www.hdfcbank.com/");
Actions action=new Actions(driver);
WebElement productsLink=driver.findElement(By.xpath("//span[text()='Products']"));
action.moveToElement(productsLink).perform();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebElement cardLink=driver.findElement(By.xpath("//span[text()='Cards']"));
action.moveToElement(cardLink).perform();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebElement creditcardLink=driver.findElement(By.xpath("//a[contains(text(),'Credit Cards')]"));
action.moveToElement(creditcardLink).perform();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//action.click(creditcardLink).perform();
creditcardLink.click();
WebElement customerLink=driver.findElement(By.xpath("//span[text()='Apply now']"));
action.moveToElement(customerLink).perform();
WebElement propertyLink=driver.findElement(By.xpath("//div[@class='lhssection']//a[text()='Loan Against Property']"));
action.moveToElement(propertyLink).perform();
action.click(propertyLink).perform();
}
}
a)The mouse pointer moves to Products->Cards->Credit Cards of the header, but it is not clicking the Credit Card link even though ive put the statments, can any one tell me how to click on the Credit Card link.
b)The mouse moves to the Apply Now of the header but fails to move over Loan Against Property(as per the code) giving an MoveTargetOutOfBoundsException,why is this exception caused and how do i resolve this?