Webdriver从服务器FireFox获得响应时停止响应

时间:2012-03-28 09:28:06

标签: c# selenium webdriver

我无法使用Firefoxdriver()。当执行nant脚本以运行所有测试时,有时不会执行测试用例。在一个随机测试用例失败,因为Webdriver正在等待来自服务器的响应,所有下一个测试用例都失败。

FF没有响应,Webdriver挂起。

此外,当所有测试完成时,FF未关闭,但应该是。

我认为原因是webdriver无法处理来自服务器的请求。

当它们单独手动执行时的所有测试都很有效,但是当脚本webdriver块中的所有测试都被执行时。

在我的案例中,页面正在响应。

  • 火狐:11
  • Webdriver:2.0.19
  • Windowx XP
  • MbUnit Gallio,Nant
  • C#

你能帮忙吗?

日志:

  

OpenQA.Selenium.WebDriverException:服务器没有对url的响应   http://localhost:7055/hub/session/573893ba-2a39-4da2-be57-33cf352a5945/element/%7Bd5b8fdf1-62fd-462b-b72c-3bc4f1be3100%7D/text   在   OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest的   请求)   C:\项目\的webdriver \树干\ DOTNET \ SRC \的webdriver \远程\ HttpCommandExecutor.cs:线   115在OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(命令   commandToExecute)in   C:\项目\的webdriver \树干\ DOTNET \ SRC \的webdriver \远程\ HttpCommandExecutor.cs:线   96点   OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Execute(命令   commandToExecute)in   C:\项目\的webdriver \树干\ DOTNET \ SRC \的webdriver \火狐\内部\ ExtensionConnection.cs:线   128在OpenQA.Selenium.Remote.RemoteWebDriver.Execute(DriverCommand   中的driverCommandToExecute,Dictionary`2参数)   C:\项目\的webdriver \树干\ DOTNET \ SRC \的webdriver \远程\ RemoteWebDriver.cs:线   795在OpenQA.Selenium.Remote.RemoteWebElement.get_Text()中   C:\项目\的webdriver \树干\ DOTNET \ SRC \的webdriver \远程\ RemoteWebElement.cs:线   96 at WebPages.TableGetRowData(String ctl_name,String name)


[FixtureSetUp]
        public void FixtureSetup()
        {
       {

         FirefoxProfile profile = new FirefoxProfile();
                        driver = new FirefoxDriver(profile);



                        driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(Convert.ToInt16(timetowait)));
                        driver.Navigate().GoToUrl(seleniumBrowserUrl + "/admin/Login/Login.aspx");
}

     [Test]
            [Category(TestCategory.Smoke)]
            [Category(TestCategory.Smoke_Players)]
            [Metadata(UserStory.Name, UserStory.AP_Wallet)]
            public void DeductMoneyFromWallet()
            {
                struct_Wallet structWalet;

                structWalet.Amount = "100,10";
                structWalet.Direction = "Debit";
                structWalet.Type = "Manual";
                structWalet.reason = "Reason Deduct Money";
                structWalet.id = "";


                DefaultPage defpage = webdrivertester.DefaultPage();
                struct_PlayerGridRow player = defpage.ClickFindPlayers()
                    .PresButtonSearch()
                    .SelectFisrtPlayer()
                    .ClickEditWalet()
                    .getAmount()
                    .SelectDeductFromWallet()
                    .TypeInputAmount(structWalet.Amount)
                    .TypeInputReason(structWalet.reason)
                    .ClickSumbitWalet()
                    .ClickWaletPopupOK()
                    .DeductValue()
                    .AssertWallet()
                    .getPlayer();


                structWalet.Username = player.username;
                driver.Navigate().GoToUrl(seleniumBrowserUrl + "/admin/default.aspx");

                DefaultPage defpage1 = webdrivertester.DefaultPage();
                defpage1.ClickMoney()
                    .ClickFundsTransactionLog()
                    .TypeInputUsername(structWalet.Username)
                    .Clicksearch()
                    .ReadFirstrowData()
                    .AssertRowWithWallet(structWalet);

            }

它在此方法中停止“.DeductValue()”,单击弹出窗口后单击“确定”。 Webdriver块,Webdriver等待服务器响应,停止测试后FF正常工作,重新加载页面。没有错误返回。当完成TestFixture运行时,此测试不起作用,当我运行时,此测试工作正常。


TimeSpan ts = new TimeSpan(0, 0, 10);
            WebDriverWait wait = new WebDriverWait(WebDriver, ts);
            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(ctl_name)));

我在我的代码中添加了wiat,其中我的页面刷新(按钮点击,链接点击,...) 但有时工作有时并不适用于相同的测试用例。 fopr 100测试案例我花6天部分解决这个问题我花了2天,感觉就像在石头上

0 个答案:

没有答案
相关问题