@@ -62,6 +62,7 @@ namespace OpenQA.Selenium.Safari
62
62
/// </example>
63
63
public class SafariDriver : WebDriver
64
64
{
65
+ private const string AttachDebuggerCommand = "attachDebugger" ;
65
66
private const string GetPermissionsCommand = "getPermissions" ;
66
67
private const string SetPermissionsCommand = "setPermissions" ;
67
68
@@ -144,10 +145,23 @@ public SafariDriver(SafariDriverService service, SafariOptions options)
144
145
public SafariDriver ( SafariDriverService service , SafariOptions options , TimeSpan commandTimeout )
145
146
: base ( new DriverServiceCommandExecutor ( service , commandTimeout ) , ConvertOptionsToCapabilities ( options ) )
146
147
{
148
+ this . AddCustomSafariCommand ( AttachDebuggerCommand , HttpCommandInfo . PostCommand , "/session/{sessionId}/apple/attach_debugger" ) ;
147
149
this . AddCustomSafariCommand ( GetPermissionsCommand , HttpCommandInfo . GetCommand , "/session/{sessionId}/apple/permissions" ) ;
148
150
this . AddCustomSafariCommand ( SetPermissionsCommand , HttpCommandInfo . PostCommand , "/session/{sessionId}/apple/permissions" ) ;
149
151
}
150
152
153
+ /// <summary>
154
+ /// This opens Safari's Web Inspector.
155
+ /// If driver subsequently executes script of "debugger;"
156
+ /// the execution will pause, no additional commands will be processed, and the code will time out.
157
+ /// </summary>
158
+ public void AttachDebugger ( )
159
+ {
160
+ Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
161
+ parameters [ "attachDebugger" ] = null ;
162
+ this . Execute ( AttachDebuggerCommand , parameters ) ;
163
+ }
164
+
151
165
/// <summary>
152
166
/// Set permission of an item on the browser. The only supported permission at this time is "getUserMedia".
153
167
/// </summary>
0 commit comments