Reputation: 57
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
Upvotes: 0
Views: 2634
Reputation: 85
You can also try for :
driver.findElement(By.xpath("//div[contains(text(),'NetBanking')]")).click();
driver.findElement(By.xpath("//li[@id='prepaidcard']")).click();
Upvotes: 0
Reputation: 1710
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
Upvotes: 1