click on a <div class >link using WebDriver click on a <div class >link using WebDriver selenium selenium

click on a <div class >link using WebDriver


Use:

driver.findElement(By.className("AddContentBTN")).click();

In case you don't know, documentation for Selenium's "By" class can be found here.


Because I stumbled upon this while looking for my own solution, this will work as well. It is for C#

driver.FindElement(By.ClassName(classNameOfOuterDiv)).FindElement(By.ClassName(nameOfClickableDiv));