public void Setup() { driver = EnvironmentManager.Instance.CreateFreshDriver(); devTools = driver as IDevTools; if (devTools != null) { session = devTools.CreateDevToolsSession(); } }
public void Setup() { driver = EnvironmentManager.Instance.GetCurrentDriver(); devTools = driver as IDevTools; if (devTools == null) { Assert.Ignore("{0} does not support Chrome DevTools Protocol", EnvironmentManager.Instance.Browser); return; } session = devTools.CreateDevToolsSession(); }
/// <summary> /// Initializes the supplied DevTools session's domains for the specified browser version within the specified number of versions. /// </summary> /// <param name="protocolVersion">The version of the DevTools Protocol to use.</param> /// <param name="session">The <see cref="DevToolsSession"/> for which to initialiize the domains.</param> /// <param name="versionRange">The range of versions within which to match the provided version number. Defaults to 5 versions.</param> /// <returns>The <see cref="DevToolsDomains"/> object containing the version-specific domains.</returns> public static DevToolsDomains InitializeDomains(int protocolVersion, DevToolsSession session, int versionRange) { if (versionRange < 0) { throw new ArgumentException("Version range must be positive", nameof(versionRange)); } DevToolsDomains domains = null; Type domainType = MatchDomainsVersion(protocolVersion, versionRange); ConstructorInfo constructor = domainType.GetConstructor(new Type[] { typeof(DevToolsSession) }); if (constructor != null) { domains = constructor.Invoke(new object[] { session }) as DevToolsDomains; } return(domains); }
/// <summary> /// Initializes the supplied DevTools session's domains for the specified browser version. /// </summary> /// <param name="protocolVersion">The version of the DevTools Protocol to use.</param> /// <param name="session">The <see cref="DevToolsSession"/> for which to initialiize the domains.</param> /// <returns>The <see cref="DevToolsDomains"/> object containing the version-specific domains.</returns> public static DevToolsDomains InitializeDomains(int protocolVersion, DevToolsSession session) { return(InitializeDomains(protocolVersion, session, DefaultVersionRange)); }
/// <summary> /// Initializes the supplied DevTools session's domains for the specified browser version within the specified number of versions. /// </summary> /// <param name="versionInfo">The <see cref="DevToolsVersionInfo"/> object containing the browser version information.</param> /// <param name="session">The <see cref="DevToolsSession"/> for which to initialiize the domains.</param> /// <param name="versionRange">The range of versions within which to match the provided version number. Defaults to 5 versions.</param> /// <returns>The <see cref="DevToolsDomains"/> object containing the version-specific domains.</returns> public static DevToolsDomains InitializeDomains(DevToolsVersionInfo versionInfo, DevToolsSession session, int versionRange) { if (versionRange < 0) { throw new ArgumentException("Version range must be positive", "versionRange"); } DevToolsDomains domains = null; int browserMajorVersion = 0; bool versionParsed = int.TryParse(versionInfo.BrowserMajorVersion, out browserMajorVersion); if (versionParsed) { Type domainType = MatchDomainsVersion(browserMajorVersion, versionRange); ConstructorInfo constructor = domainType.GetConstructor(new Type[] { typeof(DevToolsSession) }); if (constructor != null) { domains = constructor.Invoke(new object[] { session }) as DevToolsDomains; } } return(domains); }
/// <summary> /// Initializes the supplied DevTools session's domains for the specified browser version. /// </summary> /// <param name="versionInfo">The <see cref="DevToolsVersionInfo"/> object containing the browser version information.</param> /// <param name="session">The <see cref="DevToolsSession"/> for which to initialiize the domains.</param> /// <returns>The <see cref="DevToolsDomains"/> object containing the version-specific domains.</returns> public static DevToolsDomains InitializeDomains(DevToolsVersionInfo versionInfo, DevToolsSession session) { return(InitializeDomains(versionInfo, session, DefaultVersionRange)); }