Recently started working with Selenium and selenium-webdriver. I'm attempting to open Google and click on an anchor tag. See the code snippet below:
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('https://www.google.com/');
driver.wait(function () {
return driver.isElementPresent(webdriver.By.css('a'));
}, 2000);
driver.findElement(webdriver.By.css('a')).click();
driver.quit();
Selenium is throwing an
ElementNotVisibleError: element not visible
error for the selector 'a'
.
However, when I use the more specific selector '#fsl>a'
, Selenium is able to click the item.
Any suggestions or pointers would be greatly appreciated.