Esempio n. 1
0
 /// <summary>
 /// Get URL of a JavaScript library.
 /// </summary>
 /// <param name="lib">Library to get URL of.</param>
 /// <param name="location">Location to obtain library.</param>
 /// <param name="version">Version string, ie "1.4.0"</param>
 /// <returns>URL of JavaScript library.</returns>
 public static string GetLibraryPath(JavaScriptLibrary lib, LibraryLocation location, string version)
 {
     // Setup version
     if (string.IsNullOrEmpty(version))
     {
         version = _defaultVersions[lib];
     }
     if (location == LibraryLocation.Custom)
     {
         // Get location from config
         string configKey = "Forms.Contrib:LocationUrl" + lib.ToString();
         string url       = ConfigurationManager.AppSettings.Get(configKey);
         if (string.IsNullOrEmpty(url))
         {
             throw new ConfigurationErrorsException(
                       string.Format(CultureInfo.CurrentUICulture,
                                     "Custom location url was not defined in AppSettings[\"{0}\"].", configKey));
         }
         return(url);
     }
     else
     {
         return(string.Format(CultureInfo.InvariantCulture, _defaultLocations[location][lib], version));
     }
 }
Esempio n. 2
0
        public void HoverOn(IWebElement wrappedElement)
        {
            var fire = "return (" + JavaScriptLibrary.GetSeleniumScript("fireEvent.js") + ").apply(null,arguments);";

            ScriptExecutor.ExecuteScript(fire, wrappedElement, "mouseover");
            System.Threading.Thread.Sleep(1000);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the Browser class.
 /// </summary>
 protected Browser(Application application)
 {
     Application = application;
     AutoClose = false;
     AutoRefresh = true;
     Elements = new ElementCollection();
     JavascriptLibraries = new JavaScriptLibrary[0];
     Timeout = TimeSpan.FromSeconds(10);
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the Browser class.
 /// </summary>
 protected Browser()
 {
     _watch              = Stopwatch.StartNew();
     _isReconciling      = false;
     AutoClose           = false;
     JavascriptLibraries = new JavaScriptLibrary[0];
     Elements            = new ElementCollection();
     Timeout             = TimeSpan.FromMilliseconds(5000);
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the Browser class.
 /// </summary>
 protected Browser(Application application)
 {
     Application         = application;
     AutoClose           = false;
     AutoRefresh         = true;
     Elements            = new ElementCollection();
     JavascriptLibraries = new JavaScriptLibrary[0];
     Timeout             = TimeSpan.FromSeconds(10);
 }
Esempio n. 6
0
        protected void hoverOverColumnOrBarChartSeriesAtXAxisPosition(int series, String xAxisLabel)
        {
            int         barNumber        = getXAxisLabelsText().IndexOf(xAxisLabel);
            IWebElement pointToHoverOver = chart.FindElements(By.CssSelector("g.highcharts-tracker > g:nth-of-type(" + series + ") > rect"))[barNumber];

            //For browsers not supporting native events
            JavaScriptLibrary.CallEmbeddedSelenium(driver, "triggerEvent", pointToHoverOver, "mouseover");
            //For browsers supporting native events
            performAction.MoveToElement(pointToHoverOver).Perform();
        }
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            //Load the JavaScript Library from the manifest
            _library         = CBO.DeserializeObject <JavaScriptLibrary>(new StringReader(manifestNav.InnerXml));
            _library.Version = Package.Version;

            if (Log.Valid)
            {
                Log.AddInfo(Util.LIBRARY_ReadSuccess);
            }
        }
Esempio n. 8
0
        private async Task CreeNouveauJoueur()
        {
            _joueur            = new Joueur(munchkinService);
            _selectionneJoueur = false;
            _creeNouveauJoueur = true;
            StateHasChanged();

            await Task.Delay(100);

            await JavaScriptLibrary.FocusAsync("textinput", jSRuntime);
        }
Esempio n. 9
0
        public long GetElementIndex(IWebElement wrappedElement)
        {
            String script = "var _isCommentOrEmptyTextNode = function(node) {\n" +
                            "    return node.nodeType == 8 || ((node.nodeType == 3) && !(/[^\\t\\n\\r ]/.test(node.data)));\n" +
                            "}\n" +
                            "    var element = arguments[0];\n" +
                            "    var previousSibling;\n" +
                            "    var index = 0;\n" +
                            "    while ((previousSibling = element.previousSibling) != null) {\n" +
                            "        if (!_isCommentOrEmptyTextNode(previousSibling)) {\n" +
                            "            index++;\n" +
                            "        }\n" +
                            "        element = previousSibling;\n" +
                            "    }\n" +
                            "    return index;";

            return((long)JavaScriptLibrary.ExecuteScript(this._webDriver, script, wrappedElement));
        }
        public override void Install()
        {
            try
            {
                //Attempt to get the JavaScript Library
                _installedLibrary = JavaScriptLibraryController.Instance.GetLibrary(l => l.LibraryName == _library.LibraryName && l.Version == _library.Version);

                if (_installedLibrary != null)
                {
                    _library.JavaScriptLibraryID = _installedLibrary.JavaScriptLibraryID;
                }
                //Save JavaScript Library  to database
                _library.PackageID = Package.PackageID;
                JavaScriptLibraryController.Instance.SaveLibrary(_library);

                Completed = true;
                Log.AddInfo(string.Format(Util.LIBRARY_Registered, _library.LibraryName));
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
 private static string GetScriptPath(JavaScriptLibrary js)
 {
     return("~/Resources/libraries/" + js.LibraryName + "/" + Globals.FormatVersion(js.Version, "00", 3, "_") + "/" + js.FileName);
 }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the Browser class.
 /// </summary>
 protected Browser(Application application)
     : base(application, application)
 {
     AutoRefresh = true;
     JavascriptLibraries = new JavaScriptLibrary[0];
 }
Esempio n. 13
0
        public void Scroll(int x, int y)
        {
            var jsscript = "javascript:window.scroll(" + x + "," + y + ")";

            JavaScriptLibrary.ExecuteScript(this._webDriver, jsscript, "");
        }
Esempio n. 14
0
 /// <summary>
 /// Get URL of a JavaScript library.
 /// </summary>
 /// <param name="lib">Library to get URL of.</param>
 /// <param name="location">Location to obtain library.</param>
 /// <returns>URL of JavaScript library.</returns>
 public static string GetLibraryPath(JavaScriptLibrary lib, LibraryLocation location)
 {
     return(GetLibraryPath(lib, location, null));
 }
Esempio n. 15
0
 /// <summary>
 /// Get URL of a JavaScript library. Location is determined from configuration,
 /// default is to fallback to Google CDN.
 /// </summary>
 /// <param name="lib">Library to get URL of.</param>
 /// <returns>URL of JavaScript library.</returns>
 public static string GetLibraryPath(JavaScriptLibrary lib)
 {
     return(GetLibraryPath(lib, ConfigurationHelper.GetEnumSetting <LibraryLocation>(LocationSettingsKey,
                                                                                     LibraryLocation.GoogleCdn)));
 }