我正在尝试为Microsoft Dynamics CRM内部应用程序设置一些自动化测试。为此,我使用的是C#(Visual Studio 2017),Selenium(版本3.14),EasyRePro和ChromeDriver 74.0.3729.6。
我遇到的问题是,当我尝试在代码中执行第二个Browser.Grid.Switchview时,出现以下错误“遇到异常:OpenQA.Selenium.ElementClickInterceptedException:元素单击被拦截:元素...不是在(211,38)点可点击。其他元素将获得点击:“
我尝试了多种方法来避免遇到“异常:OpenQA.Selenium.ElementClickInterceptedException:元素单击被拦截:元素...在点(211,38)处不可单击。其他元素将获得单击:“。其中包括添加;
_browser.Grid.Refresh();
_browser.Grid.ClearSearch();
在两个“ _browser.Grid.SwitchView”之间
我还试图通过再次导航到子区域来重新打开子区域
_browser.Navigation.OpenSubArea("RibbonValue", "SubAreaValue");
在两个“ _browser.Grid.SwitchView”之间
然后我尝试先进入AnotherSubAreaValue,然后再回到SubAreaValue。
_browser.Navigation.OpenSubArea("RibbonValue", "AnotherSubAreaValue");
_browser.Navigation.OpenSubArea("RibbonValue", "SubAreaValue");
在两个“ _browser.Grid.SwitchView”之间
我的代码如下;
MyExtentReport _myReport;
Browser _browser;
IWebDriver _driver;
try{
//Test start
//LogInfo --> start building an HTML report page
_browser.Navigation.OpenSubArea("RibbonValue", "SubAreaValue");
_myReport.LogInfo("NAVIGATE: RibbonValue > SubAreaValue");
_browser.ThinkTime(200);
try{
// Switch the screen to the first grid view
// LogPass --> this will record the test as a pass and take a screenshot and output to the HTML report page we are building.
_browser.Grid.SwitchView("First Grid View");
_browser.ThinkTime(2000);
_myReport.LogPass(testCaseName + "This test Passed " + "\"" + "First Grid View" + "\" view is available");
_browser.ThinkTime(2000);
} catch (InvalidOperationException ex){
_myReport.LogFail(testCaseName + "This test Failed " + "\"" + "First Grid View" + "\" view is NOT available");
_browser.ThinkTime(2000);
}
try{
// Switch the screen to the first grid view
// LogPass --> this will record the test as a pass and take a screenshot and output to the HTML report page we are building.
_browser.Grid.SwitchView("Second Grid View");
_browser.ThinkTime(2000);
_myReport.LogPass(testCaseName + "This test Passed " + "\"" + "Second Grid View" + "\" view is available");
_browser.ThinkTime(2000);
} catch (InvalidOperationException ex){
_myReport.LogFail(testCaseName + "This test Failed " + "\"" + "Second Grid View" + "\" view is NOT available");
_browser.ThinkTime(200);
}
} catch (Exception e){
_myReport.LogError("Exception Experienced: " + e);
}
我希望_browser.Grid.SwitchView应该在特定的Microsoft Dynamics CRM子区域上请求的各种视图之间切换。