0

I'm trying to automate a drop down box in home page of HDFC bank in which by default 'Net banking' is selected. It does not have a Select tag and it has div tag. Also I tried to click on the drop down first and select the values one by one, but I'm getting error like

Element can't be clicked

Please help me with this.

driver.findElement(By.className("selectedvalue")).click(); //Error for this statement

2 Answers 2

1

try below

driver.findElement(By.cssSelector("div.loginwrap > div.selectWrapper > div.selectedvalue")).click();
driver.findElement(By.id("prepaidcard")).click();

I generated this from Selenium IDE for firefox. It is a plugin for Firefox which you can record user actions and export the test case to Java ( among many other languages). This is the link Selenium IDE

Sign up to request clarification or add additional context in comments.

2 Comments

Chetan_K, glad to help you. I strongly recommend you to try Selenium IDE as it is very useful in creating a selenium test case quickly.
Cool, Definitely i'll use going forward :)
0

You can also try for :

driver.findElement(By.xpath("//div[contains(text(),'NetBanking')]")).click();
driver.findElement(By.xpath("//li[@id='prepaidcard']")).click();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.