您好,我在使用硒运行单元测试时遇到问题。我的问题是我收到此异常错误:
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, 412). Other element would receive the click: <div _ngcontent-c2="" class="loader-wrapper ng-trigger ng-trigger-visibilityChanged" style="display: block;">...</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\johnny\source\repos\WebAPI\src\Tests\UnitTest1.cs:line 59
这是我的代码:
driver.Navigate().GoToUrl(url);
driver.FindElement(By.LinkText("Click Here")).Click();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMinutes(1);
driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Course Type'])[2]/following::select[1]")).Click();
new SelectElement(driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Course Type'])[2]/following::select[1]"))).SelectByText("University");