onefootswill
onefootswill

Reputation: 4107

Selenium IEDriver Not Successfully Clicking Link

I’m seeing some very strange behaviour from the IE driver for Selenium.

I progress right through a registration of a user workflow, at the end of which I would like the automated test to click the log off link.

I have employed the following code to that end:

public virtual void LogOff()
{
    SeleniumTestDriver.FindByPartialLinkText(Constants.LogoffLinkText).Click();
}

public IWebElement FindByPartialLinkText(string linkTextToFind)
{
    var linkWait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(WaitTimeout));
    return linkWait.Until(ExpectedConditions.ElementIsVisible(By.PartialLinkText(linkTextToFind)));
}

The bit that I find weird is the fact that the link is visible on the screen. I can see it, for the whole duration of the wait period. It seems to be flickering.

I have confirmed that the link is in fact a link, and not a button styled to look like a link.

Using Selenium v2.41.0 IE 11 IEDriver v2.41.1

As further info, it works perfectly in Firefox.

Am I using Selenium incorrectly?

Upvotes: 0

Views: 447

Answers (1)

Purus
Purus

Reputation: 5819

Try using sendkeys() instead of click(). This has worked without any issues in IE for me.

SeleniumTestDriver.FindByPartialLinkText(Constants.LogoffLinkText).SendKeys(Keys.Enter);

Upvotes: 1

Related Questions