James Fallon
James Fallon

Reputation: 164

Element is not clickable another element receive the click- Selenium c#

I am trying to click on a button but i have a loader that take couple of seconds before disappear. This the error that i am receiving

OpenQA.Selenium.WebDriverException
  HResult=0x80131500
  Message=unknown error: Element <select _ngcontent-c4="" class="col-xs-8 custom-input-styles custom-select ng-untouched ng-pristine ng-invalid" formcontrolname="organizationType">...</select> is not clickable at point (441, 620). Other element would receive the click: <div _ngcontent-c2="" class="loader-wrapper ng-trigger ng-trigger-visibilityChanged ng-animating" style="">...</div>
  (Session info: chrome=68.0.3440.106)
  (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64)
  Source=WebDriver
  StackTrace:
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.Click()
   at BnI.UITests.ProceedRedirect.TheProceedRedirectTest() in C:\Users\me\source\repos\WebAPI\src\UITests\UnitTest1.cs:line 60

I tried more than solution and still receiving the same error. This methods that i tried

var element = wait.Until(driver => driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Email Address'])[1]/following::input[1]")));

var element = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath("xpath=(.//*[normalize-space(text()) and normalize-space(.)='For support: info@me'])[1]/following::div[1]")));

Upvotes: 2

Views: 985

Answers (1)

Rajagopalan
Rajagopalan

Reputation: 6064

Wait for the overlaying element to disappear before you perform your click

Write this code before you click the desired element

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath("//div[@class='loader-wrapper ng-trigger ng-trigger-visibilityChanged ng-animating']")))

Upvotes: 2

Related Questions