-2

Here is the Application code

<div class="btn-group" style="margin-top: -10px; box-shadow: none !important;">
            <a class="btn btn-clear store-name headerActive" style="margin-left: 0px !important;" ng-click="account();" _href="#/app/account-addresses">
              <div class="left-logo ng-binding">SK</div><h5 class="logo-name ng-binding">sathish kumar krish</h5>
            </a>
      </div>

Its my webdriver script.

driver.findElement(By.xpath("/html/body/div[2]/div[1]/div/div/div[1]/div/a")).click();

2 Answers2

0

Try this -

WebDriverWait wait = new WebDriverWait(Driver, 10); // Wait for 10 seconds.
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[2]/div[1]/div/div/div[1]/div/a")));
WebElement element = driver.findElement(By.xpath("/html/body/div[2]/div[1]/div/div/div[1]/div/a"));
element.click();
Moser
  • 287
  • 2
  • 12
0

I have faced similar problems and I am not sure what causes it though. During this kind of situation you could be using JavaScript click event. Like the below,

WebElement element = driver.findElement(By.id("<<<Your ID>>>"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);

Hope this help!

ARN
  • 175
  • 1
  • 1
  • 13