OpenQA.Selenium.ElementNotInteractableException:无法与我的搜索脚本交互的元素?

时间:2019-10-12 17:01:38

标签: c# selenium-webdriver

现在我不知道这是否是问题,但是我有一系列脚本以并行处理方式运行,因此加载和运行速度更快。我遇到了我的脚本失败的问题,并且我得到了旧的错误,该错误不可交互或找不到元素。有人可以建议我的脚本如何应对PP的速度吗?我通过研究发现,如果您最大化屏幕,页面将完全加载并且完全可交互,但似乎仍然无法正常工作?有人可以建议一些改进吗? btw driver.Manage()。Window.Maximize();在PP下无法及时最大化

下面是我的初始化方法:

[TestInitialize]
        public void BaseTestInit()
        {            
            ChromeOptions opt = new ChromeOptions();
            opt.AddArgument("disable-infobars");
            opt.AddArguments("--start-maximized");
            opt.AddArguments("--disable-extensions");
            driver = new ChromeDriver(opt);
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(45);

           // create class for commonly used components / functions
            objCommon = new clsCommon(driver);
            _userSetRepo = new UserSetttingsRep(driver);
            _vechRep = new VechRep(driver);
            _healthRep = new HealthRep(driver);


            LoginAndSelectAutomationFleet(driver);
            //GenerationTestData();
        }

以下是我收到错误的脚本之一:OpenQA.Selenium.ElementNotInteractableException:元素不可交互

[TestCategory("VehicMgt")]
        [TestMethod]
        public void SearchVehicleByFuelType()
        {

            System.Threading.Thread.Sleep(6000);

            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            Actions builder = new Actions(driver);
            builder.MoveToElement(_regRep.SystemIcon).Click().Build().Perform(); //Hover on System
            System.Threading.Thread.Sleep(8000);
            _vechRep.VehicleMgmtLink.Click();
            //objCommon.SendKeysAndClickTab(_vechRep.fleetDropDownMenu, "fleetddd", driver);
            System.Threading.Thread.Sleep(5000);

            String fuelType = "Petrol";

            _vechRep.VehicleFueltype.SendKeys(fuelType);
            _vechRep.SearchVehicle.Click();
            System.Threading.Thread.Sleep(2000);
            //IList<IWebElement> list = _vechRep.ResultsByFuelType(fuelType);
            int actualCount = _vechRep.vehicalManagementResults.Count;

            Console.WriteLine("Actual Count of vehicles with Fuel Type " + fuelType + " is " + actualCount);

        }

0 个答案:

没有答案