2016-07-29 123 views

回答

0

尝试使用以下选择:

IWebElement saveButton = Browser.Driver.FindElement(By.CssSelector("button.primaryButton")); 
0

其实你正在使用不正确的语法在By.CssSelector。在CssSelector类属性是指使用.并且还使用FindElements返回IWebElements的集合作为ReadOnlyCollection<IWebElement>,但你期待只有单一IWebElement这是不对的,所以,你应该尝试使用FindElement,而不是返回如下的IWebElement单个对象: -

IWebElement saveButton = Browser.Driver.FindElement(By.CssSelector(".primaryButton.largeButton")); 
saveButton.Click(); 

希望它有帮助... :)