ChromeDriver挂起但是当我在FireFox上运行相同的测试时,它可以工作

时间:2014-05-22 07:39:00

标签: c# webdriver selenium-chromedriver

嗨,我有一个问题,希望你能帮助我。我在Visual Studio 2013中通过NUgent使用ChromeDriver。

这是我的Driver-class的代码:

public static void Initialize() 
        {
            Instance = new ChromeDriver()
            Instance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));    

        }

这是我的测试:

public void Editor_Can_CreateContent() 
        {
            Assert.IsTrue(ContentPage.CreateContent);
        }

这是我的课程代码

public static bool CreateContent
        {
            get
            {
                  Driver.Instance.FindElement(By.LinkText("CMS")).Click();
                  return true; //This is now for debug
            } 

当Chrome进入属性CreateContent时,它会挂起并且不会点击我的CMS链接。我已经尝试了各种各样的东西,比如XPath和partialLink但是,nada .....在FireFox中它的工作效果非常好......我在这里做错了什么?

这是HTML:

<!DOCTYPE html>
<html>
    <head><meta http-equiv="X-UA-Compatible" content="IE=edge" /><title>
    EPiServer - Dashboard
</title><link rel="stylesheet" type="text/css" href="/EPiServer/Shell/7.8.2.0/ClientResources/epi/themes/legacy/ShellCore.css" />
<link rel="stylesheet" type="text/css" href="/EPiServer/Shell/7.8.2.0/ClientResources/epi/themes/legacy/DojoDashboardCompatibility.css" />



</head>
    <body class="Sleek">



    <div data-dojo-type="dijit/layout/BorderContainer" id="rootContainer" gutters="false" style="padding: 0;height: 100%; width: 100%;">

        <div data-dojo-type="dijit/layout/ContentPane" class="epi-navigationContainer" region="top" style="border:0; overflow:visible; z-index:900">

            <div class="epi-navigation-container-root"><div class="epi-navigation epi-navigation-global"><div class="epi-navigation-container1"><ul><li class="epi-navigation-selected"><a href="/EPiServer" class="epi-navigation-global_dashboard ">Dashboard</a></li><li class="epi-navigation-util"><a href="http://www.episerver.com/" class="epi-navigation-global_banner epi-navigation-iconic" target="_blank"><span class="epi-navigation-menuIcon"><span class="epi-navigation-menuArrow"><span class="epi-navigation-menuText">EPiServer</span></span></span></a></li><li class="epi-navigation-standard "><a href="#global_cms_sub" class="epi-navigation-global_cms ">CMS</a><ul id="global_cms_sub"><li><a href="/EPiServer/Cms" class="epi-navigation-global_cms_Home ">Redigera</a></li><li><a href="/EPiServer/CMS/Admin/Default.aspx" class="epi-navigation-global_cms_admin ">Admin</a></li><li><a href="#" class="epi-navigation-global_cms_report " onclick="epi.reportCenter.open('/EPiServer/CMS/Report/default.aspx')">Rapporter</a></li><li><a href="/EPiServer/Cms/VisitorGroups" class="epi-navigation-global_cms_visitorgroup ">Besökargrupper</a></li></ul></li><li class="epi-navigation-util"><a href="http://epi-constag.regeringen.se/" class="epi-navigation-global_sites epi-navigation-currentSite epi-navigation-iconic" title="Till webbplats [http://epi-constag.regeringen.se/]"><span class="epi-navigation-menuIcon"><span class="epi-navigation-menuArrow"><span class="epi-navigation-menuText">Regeringskansliet</span></span></span></a></li><li class="epi-navigation-standard "><a href="#global_find_sub" class="epi-navigation-global_find ">Find</a><ul id="global_find_sub"><li><a href="/EPiServer/Find/IndexOverview" class="epi-navigation-global_find_overview ">Index</a></li><li><a href="/EPiServer/Find/Statistics" class="epi-navigation-global_find_statistics ">Statistik</a></li><li><a href="/EPiServer/Find/Optimizations/BestBets" class="epi-navigation-global_find_optimizations ">Optimeringar</a></li></ul></li><li class="epi-navigation-util epi-navigation-dropdown"><a href="#global_help_sub" class="epi-navigation-global_help epi-navigation-iconic" title="Hjälp"><span class="epi-navigation-menuIcon"><span class="epi-navigation-menuArrow"><span class="epi-navigation-menuText">Hjälp</span></span></span></a><ul id="global_help_sub"><li><a href="http://webhelp.episerver.com/cms/7.5/sv/Default_csh.htm" class="epi-navigation-global_help_cms " target="MCWebHelp" onclick="var popupWin=window.open('http://webhelp.episerver.com/cms/7.5/sv/Default_csh.htm','CMS','width=840, height=500, resizable=1');popupWin.focus(); return false;">CMS</a></li><li><a href="http://webhelp.episerver.com/addons/languagemanager/7.0/EN/Default.htm" class="epi-navigation-global_help_episerver.labs.languagemanager " target="MCWebHelp" onclick="var popupWin=window.open('http://webhelp.episerver.com/addons/languagemanager/7.0/EN/Default.htm','EPiServer.Labs.LanguageManager','width=840, height=500, resizable=1');popupWin.focus(); return false;">EPiServer.Labs.LanguageManager</a></li><li><a href="http://webhelp.episerver.com/addons/publishoffice/1.0/EN" class="epi-navigation-global_help_episerver.officepublish " target="MCWebHelp" onclick="var popupWin=window.open('http://webhelp.episerver.com/addons/publishoffice/1.0/EN','EPiServer.OfficePublish','width=840, height=500, resizable=1');popupWin.focus(); return false;">EPiServer.OfficePublish</a></li><li><a href="/EPiServer/Cms/About/License" class="epi-navigation-global_help_license " onclick="var popupWin=window.open('/EPiServer/Cms/About/License','license','width=820, height=700, scrollbars=yes');popupWin.focus(); return false;">Licensavtal</a></li><li><a href="/EPiServer/Shell/About/EPiServer" class="epi-navigation-global_help_about " onclick="var popupWin=window.open('/EPiServer/Shell/About/EPiServer','about','width=700, height=400, scrollbars=yes');popupWin.focus(); return false;">Om EPiServer</a></li></ul></li><li class="epi-navigation-util epi-navigation-dropdown"><a href="#global_user_sub" class="epi-navigation-global_user " title="deho"><span class="epi-navigation-menuIcon"><span class="epi-navigation-menuArrow"><span class="epi-navigation-menuText">deho</span></span></span></a><ul id="global_user_sub"><li><a href="/EPiServer/Shell/Settings" class="epi-navigation-global_user_settings ">Mina inställningar</a></li><li><a href="/util/logout.aspx" class="epi-navigation-global_user_logout ">Logga ut</a></li></ul></li><li class=" epi-navigation-dropdown"><a href="#global_more_sub" class="epi-navigation-global_more "><span class="epi-navigation-menuIcon"><span class="epi-navigation-menuArrow"><span class="epi-navigation-menuText">Mer...</span></span></span></a></li><li class="epi-navigation-util"><a href="/EPiServer/Shell/Search" class="epi-navigation-global_search epi-navigation-iconic" title="Sök"><span class="epi-navigation-menuIcon"><span class="epi-navigation-menuArrow"><span class="epi-navigation-menuText">Sök</span></span></span></a></li><li><a href="/EPiServer/AddOns" class="epi-navigation-global_addons ">Add-ons</a></li></ul></div><div class="epi-navigation-container2"></div><div class="epi-navigation-container-utils"></div></div></div><div class="epi-navigation-delimiter"></div>
        </div>

        <div data-dojo-type="epi/shell/widget/LicenseInformation" region="top"></div>
        <div id="applicationContainer" class="epi-applicationContainer" data-dojo-type="epi/shell/widget/Application" region="center"></div>
    </div>


        <script type="text/javascript">var dojoConfig = {"isDebug":false,"locale":"sv-se","parseOnLoad":false,"async":true,"paths":{"epi-languagemanager":"/EPiServer/EPiServer.Labs.LanguageManager/1.1.0.75/ClientResources/Scripts","tinymce":"/EPiServer/CMS/7.8.2.0/ClientResources/Editor/tiny_mce","epi/cms":"/EPiServer/CMS/7.8.2.0/ClientResources/epi-cms"},"aliases":[["dijit/focus","epi/patch/dijit/focus"],["dojo/window","epi/patch/dojo/window"],["dojo/store/Observable","epi/patch/dojo/store/Observable"],["epi/cms/form/SearchTextBox","epi-cms/form/SearchTextBox"],["epi/cms/contentediting/editors/SelectionEditor","epi-cms/contentediting/editors/SelectionEditor"],["epi/cms/form/PageInfoPicker","epi-cms/form/PageInfoPicker"]],"packages":[{"name":"epi-find","location":"/EPiServerFindEmbeddedResources"},{"name":"epi","location":"/EPiServer/Shell/7.8.2.0/ClientResources/EPi"},{"name":"epi-cms","location":"/EPiServer/CMS/7.8.2.0/ClientResources/epi-cms"},{"name":"epi-packaging","location":"/EPiServer/EPiServer.Packaging.UI/3.1.4.0/ClientResources/epi-packaging"}],"deferredInstrumentation":false,"useDeferredInstrumentation":"","serverTime":"2014-05-22T07:33:18.2277145Z","ioPublish":true};</script>    
        <script type="text/javascript" src="/EPiServer/Shell/7.8.2.0/ClientResources/dojo/dojo.js"></script>
        <script type="text/javascript" src="/EPiServer/Shell/7.8.2.0/ClientResources/epi/epi.js"></script>

        <script type="text/javascript" src="/EPiServer/Shell/7.8.2.0/ClientResources/DojoDashboardCompatibility.js"></script>



    <script type="text/javascript" src="/EPiServer/CMS/7.8.2.0/ClientResources/ReportCenter/ReportCenter.js"></script>



    <script id="_episerver_shell_7_8_2_0_clientresources_epi_shell_resourcebundle_js" src="/EPiServer/Shell/7.8.2.0/ClientResources/epi/shell/ResourceBundle.js" type="text/javascript"></script><script id="_episerver_shell_7_8_2_0_clientresources_epi_shell_widgets_js" src="/EPiServer/Shell/7.8.2.0/ClientResources/epi/shell/widgets.js" type="text/javascript"></script>

    <script type="text/javascript">

        require(["epi/shell/Bootstrapper"], function(Bootstrapper) {

            var settings = [{"name":"App","initializer":null,"moduleDependencies":null,"cssResources":[],"scriptResources":[],"routes":[{"routeBasePath":"/modules/{moduleArea}/{controller}/{action}/{id}","routeDefaults":{"action":"index","id":"","moduleArea":"App"}}],"helpPath":null},{"name":"Shell","initializer":"epi.shell.ShellModule","moduleDependencies":[],"cssResources":["/EPiServer/Shell/7.8.2.0/ClientResources/epi/themes/sleek/document.css","/EPiServer/Shell/7.8.2.0/ClientResources/epi/themes/sleek/sleek.css"],"scriptResources":["/EPiServer/Shell/7.8.2.0/ClientResources/epi/shell/ResourceBundle.js","/EPiServer/Shell/7.8.2.0/ClientResources/epi/shell/widgets.js"],"routes":[{"routeBasePath":"/EPiServer/{moduleArea}/{controller}/{action}/{id}","routeDefaults":{"moduleArea":"Shell","controller":"Dashboard","action":"Index","id":""}}],"helpPath":null},{"name":"EPiServer.OfficePublish","initializer":null,"moduleDependencies":null,"cssResources":[],"scriptResources":[],"routes":[{"routeBasePath":"/modules/{moduleArea}/{controller}/{action}/{id}","routeDefaults":{"action":"index","id":"","moduleArea":"EPiServer.OfficePublish"}}],"helpPath":"http://webhelp.episerver.com/addons/publishoffice/1.0/EN"},{"name":"Find","initializer":null,"moduleDependencies":[{"moduleName":"CMS","dependencyType":1}],"cssResources":[],"scriptResources":[],"routes":[{"routeBasePath":"/EPiServer/{moduleArea}/{controller}/{action}/{id}","routeDefaults":{"action":"index","id":"","moduleArea":"Find"}}],"helpPath":null},{"applicationVirtualPath":"/","startPage":7,"rootPage":1,"wastebasketPage":2,"siteAssetsFolder":3,"globalAssetsFolder":3,"contentAssetsFolder":4,"rootCategory":1,"frames":[{"id":1,"name":"_blank","description":"Open the link in a new window","localizedDescription":"Öppna länken i nytt fönster","isSystemFrame":true,"localizationService":{"providers":[{"availableLanguages":["en"],"name":"EPiServerShellModulesResources","description":"EPiServerShellModulesResources"},{"availableLanguages":["en","sv","da","fi","nb","nl","de","es","fr","ja","no","pt","zh-CN"],"name":"EPiServerShellProductModulesResources","description":"EPiServerShellProductModulesResources"}],"availableLocalizations":["en","sv","da","fi","nb","nl","de","es","fr","ja","no","pt","zh-CN"],"fallbackBehavior":5,"fallbackCulture":"en"}},{"id":2,"name":"_top","description":"Open the link in the whole window","localizedDescription":"Öppna länken i hela fönstret","isSystemFrame":true,"localizationService":{"providers":[{"availableLanguages":["en"],"name":"EPiServerShellModulesResources","description":"EPiServerShellModulesResources"},{"availableLanguages":["en","sv","da","fi","nb","nl","de","es","fr","ja","no","pt","zh-CN"],"name":"EPiServerShellProductModulesResources","description":"EPiServerShellProductModulesResources"}],"availableLocalizations":["en","sv","da","fi","nb","nl","de","es","fr","ja","no","pt","zh-CN"],"fallbackBehavior":5,"fallbackCulture":"en"}}],"userName":"deho","useLegacyEditMode":false,"displayResolutions":[],"currentContentLanguage":"sv","contentRepositoryDescriptors":{"pages":{"key":"pages","name":"Sidor","roots":["1"],"searchArea":"cms/pages","customNavigationWidget":"epi-cms/component/PageNavigationTree","containedTypes":["episerver.core.pagedata"],"linkableTypes":["episerver.core.pagedata"],"preventDeletionFor":["7","1","2"],"preventCopyingFor":["1","2"],"mainViews":["/episerver/cms/home"],"sortOrder":100,"customSelectTitle":"Sida","creatableTypes":["episerver.core.pagedata"],"mainNavigationTypes":null,"preventContextualContentFor":["1","2"]},"blocks":{"key":"blocks","name":"Block","roots":["3"],"searchArea":"CMS/blocks","containedTypes":["episerver.core.contentfolder","episerver.core.blockdata"],"creatableTypes":["episerver.core.blockdata"],"mainNavigationTypes":["episerver.core.contentfolder"],"sortOrder":200,"mainViews":["/episerver/cms/home"],"customSelectTitle":"Block","changeContextOnItemSelection":true,"customNavigationWidget":null,"preventContextualContentFor":["1","2"],"preventDeletionFor":null,"preventCopyingFor":null,"linkableTypes":null},"media":{"key":"media","name":"Media","roots":["3"],"searchArea":"CMS/files","creatableTypes":[],"containedTypes":["episerver.core.contentfolder","episerver.core.icontentmedia"],"mainNavigationTypes":["episerver.core.contentfolder"],"linkableTypes":["episerver.core.icontentmedia","episerver.core.icontentimage","episerver.core.icontentvideo"],"sortOrder":300,"mainViews":["/episerver/cms/media"],"changeContextOnItemSelection":true,"customNavigationWidget":null,"preventContextualContentFor":["1","2"],"preventDeletionFor":null,"preventCopyingFor":null,"customSelectTitle":null}},"expirationNotificationPeriod":5184000,"imageEditorEnabled":true,"disableVersionDeletion":false,"name":"CMS","initializer":"epi-cms.CMSModule","moduleDependencies":[{"moduleName":"Shell","dependencyType":1}],"cssResources":["/static/css/Episerver/UIExtensions.css","/EPiServer/CMS/7.8.2.0/ClientResources/epi-cms/epi.css"],"scriptResources":["/EPiServer/CMS/7.8.2.0/ClientResources/epi-cms/ResourceBundle.js","/EPiServer/CMS/7.8.2.0/ClientResources/epi-cms/widgets.js","/EPiServer/CMS/7.8.2.0/ClientResources/ReportCenter/ReportCenter.js","/util/javascript/episerverscriptmanager.js","/EPiServer/CMS/javascript/system.js","/EPiServer/CMS/javascript/dialog.js","/EPiServer/CMS/javascript/system.aspx"],"routes":[{"routeBasePath":"/EPiServer/{moduleArea}/{controller}/{action}/{id}","routeDefaults":{"controller":"Home","action":"Index","id":"","moduleArea":"CMS"}},{"routeBasePath":"/EPiServer/CMS/{path}","routeDefaults":{"moduleArea":"LegacyCMS"}},{"routeBasePath":"/util/{path}","routeDefaults":{"moduleArea":"Util"}}],"helpPath":"http://webhelp.episerver.com/cms/7.5/sv/Default_csh.htm"},{"name":"EPiServer.Packaging.UI","initializer":null,"moduleDependencies":[{"moduleName":"Shell","dependencyType":1}],"cssResources":[],"scriptResources":["/EPiServer/EPiServer.Packaging.UI/3.1.4.0/ClientResources/epi-packaging/ResourceBundle.js","/EPiServer/EPiServer.Packaging.UI/3.1.4.0/ClientResources/epi-packaging/packaging.js"],"routes":[{"routeBasePath":"/EPiServer/AddOns/{controller}/{action}","routeDefaults":{"moduleArea":"EPiServer.Packaging.UI","controller":"AddOns","action":"Index"}}],"helpPath":null},{"name":"EPiServer.Labs.LanguageManager","initializer":"epi-languagemanager.LanguageManagerModule","moduleDependencies":[{"moduleName":"Shell","dependencyType":1},{"moduleName":"CMS","dependencyType":1}],"cssResources":["/EPiServer/EPiServer.Labs.LanguageManager/1.1.0.75/ClientResources/EPiServer.Labs.LanguageManager.css"],"scriptResources":[],"routes":[{"routeBasePath":"/EPiServer/{moduleArea}/{controller}/{action}/","routeDefaults":{"moduleArea":"EPiServer.Labs.LanguageManager","controller":"","action":"Index"}}],"helpPath":"http://webhelp.episerver.com/addons/languagemanager/7.0/EN/Default.htm"}],
                viewSettings = {"defaultContext":null,"componentCategories":["dashboard"]},
                bootStrapper = new Bootstrapper(settings);

            bootStrapper.initializeApplication("/episerver/dashboard", "Shell", viewSettings).then(function() {
                require([
                        "dojo/_base/connect",
                        "dojo/parser",
                        "dijit/registry",
                        "dijit/layout/BorderContainer",
                        "dijit/layout/ContentPane",
                        "epi/shell/widget/GlobalMenu",
                        "epi/shell/widget/Application",
                        "epi/shell/widget/LicenseInformation",
                        "epi/shell/widget/ApplicationContentPane",
                        "dojo/domReady!"], 
                    function (connect, parser, registry) {

                        parser.parse();


                        // Trigger layout when the global navigation changes its layout.
                        connect.subscribe("/epi/shell/globalnavigation/layoutchange", null,  function() { 
                            registry.byId("rootContainer").layout(); 
                        });

                    });
            });
        });
    </script>



    </body>
</html>

0 个答案:

没有答案