@@ -72,7 +72,6 @@ const webRoot = 'body'
72
72
* @prop {object } [timeouts] [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
73
73
* @prop {boolean } [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
74
74
* @prop {string } [logLevel=silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
75
- * @prop {boolean } [devtoolsProtocol=false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
76
75
*/
77
76
const config = { }
78
77
@@ -180,7 +179,6 @@ const config = {}
180
179
* WebDriver : {
181
180
* url: "http://localhost",
182
181
* browser: "chrome",
183
- * devtoolsProtocol: true,
184
182
* desiredCapabilities: {
185
183
* chromeOptions: {
186
184
* args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
@@ -614,11 +612,6 @@ class WebDriver extends Helper {
614
612
delete this . options . capabilities . hostname
615
613
delete this . options . capabilities . port
616
614
delete this . options . capabilities . path
617
- if ( this . options . devtoolsProtocol ) {
618
- if ( ! [ 'chrome' , 'chromium' ] . includes ( this . options . browser . toLowerCase ( ) ) )
619
- throw Error ( 'The devtools protocol is only working with Chrome or Chromium' )
620
- this . options . automationProtocol = 'devtools'
621
- }
622
615
this . browser = await webdriverio . remote ( this . options )
623
616
}
624
617
} catch ( err ) {
@@ -649,11 +642,6 @@ class WebDriver extends Helper {
649
642
this . browser . capabilities . platformName = this . browser . capabilities . platformName . toLowerCase ( )
650
643
}
651
644
652
- if ( this . options . automationProtocol ) {
653
- this . puppeteerBrowser = await this . browser . getPuppeteer ( )
654
- this . page = ( await this . puppeteerBrowser . pages ( ) ) [ 0 ]
655
- }
656
-
657
645
return this . browser
658
646
}
659
647
@@ -1143,10 +1131,6 @@ class WebDriver extends Helper {
1143
1131
assertElementExists ( res , field , 'Field' )
1144
1132
const elem = usingFirstElement ( res )
1145
1133
highlightActiveElement . call ( this , elem )
1146
- if ( this . options . automationProtocol ) {
1147
- const curentValue = await elem . getValue ( )
1148
- return elem . setValue ( curentValue + value . toString ( ) )
1149
- }
1150
1134
return elem . addValue ( value . toString ( ) )
1151
1135
}
1152
1136
@@ -1159,9 +1143,6 @@ class WebDriver extends Helper {
1159
1143
assertElementExists ( res , field , 'Field' )
1160
1144
const elem = usingFirstElement ( res )
1161
1145
highlightActiveElement . call ( this , elem )
1162
- if ( this . options . automationProtocol ) {
1163
- return elem . setValue ( '' )
1164
- }
1165
1146
return elem . clearValue ( getElementId ( elem ) )
1166
1147
}
1167
1148
@@ -1231,7 +1212,7 @@ class WebDriver extends Helper {
1231
1212
const el = usingFirstElement ( res )
1232
1213
1233
1214
// Remote Upload (when running Selenium Server)
1234
- if ( this . options . remoteFileUpload && ! this . options . automationProtocol ) {
1215
+ if ( this . options . remoteFileUpload ) {
1235
1216
try {
1236
1217
this . debugSection ( 'File' , 'Uploading file to remote server' )
1237
1218
file = await this . browser . uploadFile ( file )
@@ -2593,9 +2574,6 @@ class WebDriver extends Helper {
2593
2574
async switchTo ( locator ) {
2594
2575
this . browser . isInsideFrame = true
2595
2576
if ( Number . isInteger ( locator ) ) {
2596
- if ( this . options . automationProtocol ) {
2597
- return this . browser . switchToFrame ( locator + 1 )
2598
- }
2599
2577
return this . browser . switchToFrame ( locator )
2600
2578
}
2601
2579
if ( ! locator ) {
@@ -2734,44 +2712,6 @@ class WebDriver extends Helper {
2734
2712
return this . executeScript ( getScrollPosition )
2735
2713
}
2736
2714
2737
- /**
2738
- * This method is **deprecated**.
2739
- *
2740
- *
2741
- * {{> setGeoLocation }}
2742
- */
2743
- async setGeoLocation ( latitude , longitude ) {
2744
- if ( ! this . options . automationProtocol ) {
2745
- console . log ( `setGeoLocation deprecated:
2746
- * This command is deprecated due to using deprecated JSON Wire Protocol command. More info: https://webdriver.io/docs/api/jsonwp/#setgeolocation
2747
- * Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration` )
2748
- return
2749
- }
2750
- this . geoLocation = { latitude, longitude }
2751
-
2752
- await this . browser . call ( async ( ) => {
2753
- const pages = await this . puppeteerBrowser . pages ( )
2754
- await pages [ 0 ] . setGeolocation ( { latitude, longitude } )
2755
- } )
2756
- }
2757
-
2758
- /**
2759
- * This method is **deprecated**.
2760
- *
2761
- * {{> grabGeoLocation }}
2762
- *
2763
- */
2764
- async grabGeoLocation ( ) {
2765
- if ( ! this . options . automationProtocol ) {
2766
- console . log ( `grabGeoLocation deprecated:
2767
- * This command is deprecated due to using deprecated JSON Wire Protocol command. More info: https://webdriver.io/docs/api/jsonwp/#getgeolocation
2768
- * Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration` )
2769
- return
2770
- }
2771
- if ( ! this . geoLocation ) return 'No GeoLocation is set!'
2772
- return this . geoLocation
2773
- }
2774
-
2775
2715
/**
2776
2716
* {{> grabElementBoundingRect }}
2777
2717
*/
@@ -2810,127 +2750,6 @@ class WebDriver extends Helper {
2810
2750
runInWeb ( fn ) {
2811
2751
return fn ( )
2812
2752
}
2813
-
2814
- /**
2815
- *
2816
- * _Note:_ Only works when devtoolsProtocol is enabled.
2817
- *
2818
- * {{> flushNetworkTraffics }}
2819
- */
2820
- flushNetworkTraffics ( ) {
2821
- if ( ! this . options . automationProtocol ) {
2822
- console . log (
2823
- '* Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration' ,
2824
- )
2825
- return
2826
- }
2827
- this . requests = [ ]
2828
- }
2829
-
2830
- /**
2831
- *
2832
- * _Note:_ Only works when devtoolsProtocol is enabled.
2833
- *
2834
- * {{> stopRecordingTraffic }}
2835
- */
2836
- stopRecordingTraffic ( ) {
2837
- if ( ! this . options . automationProtocol ) {
2838
- console . log (
2839
- '* Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration' ,
2840
- )
2841
- return
2842
- }
2843
- this . page . removeAllListeners ( 'request' )
2844
- this . recording = false
2845
- }
2846
-
2847
- /**
2848
- *
2849
- * _Note:_ Only works when devtoolsProtocol is enabled.
2850
- *
2851
- * {{> startRecordingTraffic }}
2852
- *
2853
- */
2854
- async startRecordingTraffic ( ) {
2855
- if ( ! this . options . automationProtocol ) {
2856
- console . log (
2857
- '* Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration' ,
2858
- )
2859
- return
2860
- }
2861
- this . flushNetworkTraffics ( )
2862
- this . recording = true
2863
- this . recordedAtLeastOnce = true
2864
-
2865
- await this . page . setRequestInterception ( true )
2866
-
2867
- this . page . on ( 'request' , ( request ) => {
2868
- const information = {
2869
- url : request . url ( ) ,
2870
- method : request . method ( ) ,
2871
- requestHeaders : request . headers ( ) ,
2872
- requestPostData : request . postData ( ) ,
2873
- response : request . response ( ) ,
2874
- }
2875
-
2876
- this . debugSection ( 'REQUEST: ' , JSON . stringify ( information ) )
2877
-
2878
- if ( typeof information . requestPostData === 'object' ) {
2879
- information . requestPostData = JSON . parse ( information . requestPostData )
2880
- }
2881
- request . continue ( )
2882
- this . requests . push ( information )
2883
- } )
2884
- }
2885
-
2886
- /**
2887
- *
2888
- * _Note:_ Only works when devtoolsProtocol is enabled.
2889
- *
2890
- * {{> grabRecordedNetworkTraffics }}
2891
- */
2892
- async grabRecordedNetworkTraffics ( ) {
2893
- if ( ! this . options . automationProtocol ) {
2894
- console . log (
2895
- '* Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration' ,
2896
- )
2897
- return
2898
- }
2899
- return grabRecordedNetworkTraffics . call ( this )
2900
- }
2901
-
2902
- /**
2903
- *
2904
- * _Note:_ Only works when devtoolsProtocol is enabled.
2905
- *
2906
- * {{> seeTraffic }}
2907
- */
2908
- async seeTraffic ( { name, url, parameters, requestPostData, timeout = 10 } ) {
2909
- if ( ! this . options . automationProtocol ) {
2910
- console . log (
2911
- '* Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration' ,
2912
- )
2913
- return
2914
- }
2915
- await seeTraffic . call ( this , ...arguments )
2916
- }
2917
-
2918
- /**
2919
- *
2920
- * _Note:_ Only works when devtoolsProtocol is enabled.
2921
- *
2922
- * {{> dontSeeTraffic }}
2923
- *
2924
- */
2925
- dontSeeTraffic ( { name, url } ) {
2926
- if ( ! this . options . automationProtocol ) {
2927
- console . log (
2928
- '* Switch to devtools protocol to use this command by setting devtoolsProtocol: true in the configuration' ,
2929
- )
2930
- return
2931
- }
2932
- dontSeeTraffic . call ( this , ...arguments )
2933
- }
2934
2753
}
2935
2754
2936
2755
async function proceedSee ( assertType , text , context , strict = false ) {
0 commit comments