How to click a href link using Selenium
webDriver.findElement(By.xpath("//a[@href='/docs/configuration']")).click();
The above line works fine. Please remove the space after href.
Is that element is visible in the page, if the element is not visible please scroll down the page then perform click action.
Use
driver.findElement(By.linkText("App Configuration")).click()
Other Approaches will be
JavascriptLibrary jsLib = new JavascriptLibrary(); jsLib.callEmbeddedSelenium(selenium, "triggerMouseEventAt", elementToClick,"click", "0,0");
or
((JavascriptExecutor) driver).executeScript("arguments[0].click();", elementToClick);
For detailed answer, View this post
Use an explicit wait
for the element like this:
WebDriverWait wait1 = new WebDriverWait(driver, 500);wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("path of element"))).click();