-1
我已经做了一些使用硒的测试。我在visual studio 2015中创建了我的解决方案,所有的测试都运行良好,但是当我在visual studio 2017中运行我的测试时,除了需要右键单击时,我的所有测试都可以工作。上下文点击(右键)不工作visual studio 2017
我不知道这是为什么在Visual Studio中只发生了2017年
我得到一个运行时错误说,元素为null但是在行之前我试着右击我可以左键单击元素所以我知道这个元素不是null。
我的代码如下
var webDriverWait = new WebDriverWait(session, TimeSpan.FromSeconds(10));
Actions action = new Actions(session);
CommonMethods.switchWindows(session);
CommonMethods.keyCheck(session);
Thread.Sleep(2000);
webDriverWait.Until(ExpectedConditions.ElementToBeClickable(session.FindElementByName($"{fileName} - PowerPoint"))).Click();
Thread.Sleep(2000);
webDriverWait.Until(ExpectedConditions.ElementToBeClickable(session.FindElementByName("Create"))).Click();
webDriverWait.Until(ExpectedConditions.ElementToBeClickable(session.FindElementByName("View Links"))).Click();
CommonMethods.IsElementDisplayed(session, new StackTrace(true).GetFrame(0).GetFileLineNumber(), new StackTrace(true).GetFrame(0).GetMethod(), "CreateErrorIcon", "Error appeard when selecting the View Links button");
webDriverWait.Until(ExpectedConditions.ElementToBeClickable(session.FindElementByName("Create"))).Click();
var e =webDriverWait.Until(ExpectedConditions.ElementToBeClickable(session.FindElementByName(SlideNumber)));
e.Click();
action.ContextClick(e).Perform();
webDriverWait.Until(ExpectedConditions.ElementToBeClickable(session.FindElementByName(element))).Click();
keyCheck(session);
您可以发布完整例外吗? – Guy