1- // <copyright file="DevToolsomainFactory .cs" company="WebDriver Committers">
1+ // <copyright file="IDomains .cs" company="WebDriver Committers">
22// Licensed to the Software Freedom Conservancy (SFC) under one
33// or more contributor license agreements. See the NOTICE file
44// distributed with this work for additional information
1414// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515// See the License for the specific language governing permissions and
1616// limitations under the License.
17- // </copyright>
1817
1918using System ;
2019using System . Collections . Generic ;
2423namespace OpenQA . Selenium . DevTools
2524{
2625 /// <summary>
27- /// Factory class used to create the set of DevTools Protocol domains specific to the specified version of the browser .
26+ /// Interface providing version-independent implementations of operations available using the DevTools Protocol .
2827 /// </summary>
29- public static class DevToolsDomainFactory
28+ public abstract class DevToolsDomains
3029 {
3130 // By default, we will look for a supported version within this
3231 // number of versions, as that will most likely still work.
@@ -43,33 +42,57 @@ public static class DevToolsDomainFactory
4342 typeof ( V84 . V84Domains )
4443 } ;
4544
45+ /// <summary>
46+ /// Gets the version-specific domains for the DevTools session. This value must be cast to a version specific type to be at all useful.
47+ /// </summary>
48+ public abstract DevToolsSessionDomains VersionSpecificDomains { get ; }
49+
50+ /// <summary>
51+ /// Gets the object used for manipulating network information in the browser.
52+ /// </summary>
53+ public abstract Network Network { get ; }
54+
55+ /// <summary>
56+ /// Gets the object used for manipulating the browser's JavaScript execution.
57+ /// </summary>
58+ public abstract JavaScript JavaScript { get ; }
59+
60+ /// <summary>
61+ /// Gets the object used for manipulating DevTools Protocol targets.
62+ /// </summary>
63+ public abstract Target Target { get ; }
64+
65+ /// <summary>
66+ /// Gets the object used for manipulating the browser's logs.
67+ /// </summary>
68+ public abstract Log Log { get ; }
69+
4670 /// <summary>
4771 /// Initializes the supplied DevTools session's domains for the specified browser version.
4872 /// </summary>
4973 /// <param name="versionInfo">The <see cref="DevToolsVersionInfo"/> object containing the browser version information.</param>
5074 /// <param name="session">The <see cref="DevToolsSession"/> for which to initialiize the domains.</param>
51- /// <returns>The <see cref="IDomains "/> object containing the version-specific domains.</returns>
52- public static IDomains InitializeDomains ( DevToolsVersionInfo versionInfo , DevToolsSession session )
75+ /// <returns>The <see cref="DevToolsDomains "/> object containing the version-specific domains.</returns>
76+ public static DevToolsDomains InitializeDomains ( DevToolsVersionInfo versionInfo , DevToolsSession session )
5377 {
5478 return InitializeDomains ( versionInfo , session , DefaultVersionRange ) ;
5579 }
5680
57-
5881 /// <summary>
5982 /// Initializes the supplied DevTools session's domains for the specified browser version within the specified number of versions.
6083 /// </summary>
6184 /// <param name="versionInfo">The <see cref="DevToolsVersionInfo"/> object containing the browser version information.</param>
6285 /// <param name="session">The <see cref="DevToolsSession"/> for which to initialiize the domains.</param>
6386 /// <param name="versionRange">The range of versions within which to match the provided version number. Defaults to 5 versions.</param>
64- /// <returns>The <see cref="IDomains "/> object containing the version-specific domains.</returns>
65- public static IDomains InitializeDomains ( DevToolsVersionInfo versionInfo , DevToolsSession session , int versionRange )
87+ /// <returns>The <see cref="DevToolsDomains "/> object containing the version-specific domains.</returns>
88+ public static DevToolsDomains InitializeDomains ( DevToolsVersionInfo versionInfo , DevToolsSession session , int versionRange )
6689 {
6790 if ( versionRange < 0 )
6891 {
6992 throw new ArgumentException ( "Version range must be positive" , "versionRange" ) ;
7093 }
7194
72- IDomains domains = null ;
95+ DevToolsDomains domains = null ;
7396 int browserMajorVersion = 0 ;
7497 bool versionParsed = int . TryParse ( versionInfo . BrowserMajorVersion , out browserMajorVersion ) ;
7598 if ( versionParsed )
@@ -78,7 +101,7 @@ public static IDomains InitializeDomains(DevToolsVersionInfo versionInfo, DevToo
78101 ConstructorInfo constructor = domainType . GetConstructor ( new Type [ ] { typeof ( DevToolsSession ) } ) ;
79102 if ( constructor != null )
80103 {
81- domains = constructor . Invoke ( new object [ ] { session } ) as IDomains ;
104+ domains = constructor . Invoke ( new object [ ] { session } ) as DevToolsDomains ;
82105 }
83106 }
84107
@@ -90,7 +113,7 @@ private static Type MatchDomainsVersion(int desiredVersion, int versionRange)
90113 // Use reflection to look for a DevToolsVersion static field on every known domain implementation type
91114 foreach ( Type candidateType in SupportedDevToolsVersions )
92115 {
93- FieldInfo info = candidateType . GetField ( "DevToolsVersion" , BindingFlags . Static | BindingFlags . Public ) ;
116+ PropertyInfo info = candidateType . GetProperty ( "DevToolsVersion" , BindingFlags . Static | BindingFlags . Public ) ;
94117 if ( info != null )
95118 {
96119 object propertyValue = info . GetValue ( null ) ;
0 commit comments