2

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]")));

1 Answer 1

2

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']")))
Sign up to request clarification or add additional context in comments.

3 Comments

i am receiving this now OpenQA.Selenium.StaleElementReferenceException: 'stale element reference: element is not attached to the page document
@JamesFallon Okay, put this block in try catch block and then in the catch block, you call the find element once again, it would work. I usually advice people to use WATIR when they face stale element because WATIR automatically handles stale element.
this is funny now. The test is done correct when i debug but when i run it i receive same error "not clickable"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.