1
votes

I am trying find xpath for customer id for the following website-

https://netbanking.hdfcbank.com/netbanking/?_ga=1.219943581.521154242.1455311784

I have tried various XPath's such as -

1.//input[@class='input_password'] 2.html/body/form/table[2]/tbody/tr/td[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td[2]/table/tbody/tr[2]/td[2]/span/input

But none of them seem to be working. I am using selenium webDriver to sendkeys for eg '123456' to that customer id box and hit continue button. But selenium is not able to find the element everytime. Can somebody please help me with that!

1
guys any help or suggestions would greatly be appreciated!!Ajay

1 Answers

4
votes

The text box is inside frame, you need to switch to it first

// switch to the frame
driver.switchTo().frame("login_page");

// find the text box and write to it 
driver.findElement(By.className("input_password")).sendKeys("123456");

// switch back to main window
driver.switchTo().defaultContent();