Reputation: 13
My doubt is how to click/select Div elements in Selenium using java?
I tried like this:
String divId = driver.findElement(By.tagName("Div")).getAttribute("Div Value");
driver.findElement(By.id(divId)).click();
But in the above code im getting divId as NULL.Thats why im getting IlleagalArgumentsException.
Upvotes: 0
Views: 91
Reputation: 1291
If your div is in a frame tag first just switch to that frame and do rest..
Upvotes: 2
Reputation: 15698
In order to get id
of the div Change
String divId = driver.findElement(By.tagName("Div")).getAttribute("Div Value");
to
String divId = driver.findElement(By.tagName("div")).getAttribute("id");
Upvotes: 0