Find Xpath for element in Selenium Java
As the element is an Angular element to click on it, you need to use WebDriverWait for the elementToBeClickable()
and you can use either of the following Locator Strategies:
cssSelector
:new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("a[@href='https://www.google.com/gmail/'] h3"))).click();
xpath
:new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//h3[text()='Gmail by Google']"))).click();