我有一个Selenium框架,自创建以来一直畅通无阻.我今天实现了Visual Studio团队资源管理器,在从远程分支拉出后,Intellisense开始对我大吼大叫,说我的一个命名空间不存在.它不喜欢的线条是
using PageObjectModel.PageObjects.Maintenance;
和
var SettlementAccountReconciliations = new SettlementAccountReconciliation(_driver);
SettlementAccountReconciliation位于Maintenance目录中.这是我的测试类的完整代码,它不喜欢该目录:
using NLog.Internal; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using PageObjectModel.ControlObjects; using PageObjectModel.PageObjects; using PageObjectModel.PageObjects.Process; using PageObjectModel.PageObjects.Status; using System; using PageObjectModel.PageObjects.Maintenance; // **LINE WITH MAINTENANCE UNDERLINED** namespace PageObjectModel.Tests.TaskTesting { [TestFixture] class JiraTaskTesting { private IWebDriver _driver; [OneTimeSetUp] public void SetUp() { _driver = new ChromeDriver(); DriverContext.Driver = _driver; _driver.Manage().Window.Maximize(); var ConfigManager = new ConfigurationManager(); var Login = new Login(_driver); Login.SignIn(ConfigManager.AppSettings["Username"],ConfigManager.AppSettings["Password"]); } [Test] public void ReportNameStandardizationSettlementAccountReconciliations() { // **LINE WITH UNDERLINE** var SettlementAccountReconciliations = new SettlementAccountReconciliation(_driver); var Utilities = new Utilities(_driver); var ReportPopup = SettlementAccountReconciliations.ExportReconciliationReport(); ReportPopup.StartDate.SetValue(DateTime.Now.ToString("MM/dd/yyyy")); ReportPopup.EndDate.SetValue(DateTime.Now.ToString("MM/dd/yyyy")); ReportPopup.ExportButton.Click(); Assert.IsTrue(Utilities.ValidateFilePresent("Settlement Account Reconciliation")); Utilities.DeleteFile("Settlement Account Reconciliation"); }
此外,还有维护命名空间中的SettlementAccountReconciliation:
using OpenQA.Selenium; using OpenQA.Selenium.Support.PageObjects; using OpenQA.Selenium.Support.UI; using System; namespace PageObjectModel.PageObjects.Maintenance { public class SettlementAccountReconciliation { private readonly IWebDriver _driver; public SettlementAccountReconciliation(IWebDriver driver) { _driver = driver; PageFactory.InitElements(driver,this); var Utilities = new Utilities(driver); string TradingUrl = Utilities.RefactorUrl("/SettlementAccountReconciliation"); driver.Navigate().GoToUrl(TradingUrl); webdriverwait Wait = new webdriverwait(driver,TimeSpan.FromSeconds(10)); try { Wait.Until(ExpectedConditions.ElementExists(By.XPath("//a[text()='Settlement Account Reconciliations']"))); Console.WriteLine("SettlementAccountReconciliation Page Label Found"); } catch { Console.WriteLine("SettlementAccountReconciliation Page Label Not Found,timing out"); } }
这是我的指令测试类中显示的图像:
对于SettlementAccountReconciliation构造函数:
我拥有Page Object Model格式的所有代码,这就是我的文件结构的排列方式:
我知道这个问题很长,但要继续,测试运行得很好,解决方案就像魅力一样.我只需要弄清楚如何让文本编辑器不要认为我的代码存在问题.
Visual Studio告诉我“类型或命名空间名称’维护’在命名空间PageObjectModel.PageObjects’中不存在”,但确实如此.
任何有关这方面的帮助将不胜感激.
编辑:
我修好了它.
我不知道它为什么有效,但确实如此.
我所做的只是将Maintenance文件夹重命名为Maintenance1,重新创建了Maintenance文件夹,并将SettlementAccountReconciliation类拖放到Maintenance文件夹中.
我猜测在Timbuktu的某个临时文件夹中存储了一些随机属性或设置,这些文件存储在创建新文件夹时重置或删除的现有文件夹中.
感谢所有花时间帮助我的人!
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。