|
| 1 | +using OpenQA.Selenium.Remote; |
| 2 | + |
| 3 | +namespace OpenQA.Selenium.IE |
| 4 | +{ |
| 5 | + // This is a simple wrapper class to create an InternetExplorerDriver that |
| 6 | + // uses the enables RequireWindowFocus as the default input simplation. |
| 7 | + public class EdgeInternetExplorerModeDriver : InternetExplorerDriver |
| 8 | + { |
| 9 | + private static string servicePath = string.Empty; |
| 10 | + |
| 11 | + public EdgeInternetExplorerModeDriver(InternetExplorerDriverService service) |
| 12 | + : this(service, DefaultOptions) |
| 13 | + { |
| 14 | + } |
| 15 | + |
| 16 | + public EdgeInternetExplorerModeDriver(InternetExplorerDriverService service, InternetExplorerOptions options) |
| 17 | + : base(service, options) |
| 18 | + { |
| 19 | + } |
| 20 | + |
| 21 | + public static string ServicePath |
| 22 | + { |
| 23 | + get { return servicePath; } |
| 24 | + set { servicePath = value; } |
| 25 | + } |
| 26 | + |
| 27 | + public static InternetExplorerDriverService DefaultService |
| 28 | + { |
| 29 | + get |
| 30 | + { |
| 31 | + InternetExplorerDriverService service; |
| 32 | + if (string.IsNullOrEmpty(servicePath)) |
| 33 | + { |
| 34 | + service = InternetExplorerDriverService.CreateDefaultService(); |
| 35 | + } |
| 36 | + else |
| 37 | + { |
| 38 | + service = InternetExplorerDriverService.CreateDefaultService(servicePath); |
| 39 | + } |
| 40 | + |
| 41 | + // For debugging purposes, one can uncomment the following lines |
| 42 | + // to generate a log from the driver executable. Please do not |
| 43 | + // commit changes to this file with these lines uncommented. |
| 44 | + // service.LogFile = @"iedriver.log"; |
| 45 | + // service.LoggingLevel = InternetExplorerDriverLogLevel.Debug; |
| 46 | + return service; |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + public static InternetExplorerOptions DefaultOptions |
| 51 | + { |
| 52 | + get { return new InternetExplorerOptions() { RequireWindowFocus = true, UsePerProcessProxy = true, AttachToEdgeChrome = true, EdgeExecutablePath = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" }; } |
| 53 | + } |
| 54 | + } |
| 55 | +} |
0 commit comments