@@ -614,11 +614,6 @@ class WebDriver extends Helper {
614614 delete this . options . capabilities . hostname
615615 delete this . options . capabilities . port
616616 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- }
622617 this . browser = await webdriverio . remote ( this . options )
623618 }
624619 } catch ( err ) {
@@ -649,10 +644,8 @@ class WebDriver extends Helper {
649644 this . browser . capabilities . platformName = this . browser . capabilities . platformName . toLowerCase ( )
650645 }
651646
652- if ( this . options . automationProtocol ) {
653- this . puppeteerBrowser = await this . browser . getPuppeteer ( )
654- this . page = ( await this . puppeteerBrowser . pages ( ) ) [ 0 ]
655- }
647+ this . puppeteerBrowser = await this . browser . getPuppeteer ( )
648+ this . page = ( await this . puppeteerBrowser . pages ( ) ) [ 0 ]
656649
657650 return this . browser
658651 }
@@ -1143,10 +1136,6 @@ class WebDriver extends Helper {
11431136 assertElementExists ( res , field , 'Field' )
11441137 const elem = usingFirstElement ( res )
11451138 highlightActiveElement . call ( this , elem )
1146- if ( this . options . automationProtocol ) {
1147- const curentValue = await elem . getValue ( )
1148- return elem . setValue ( curentValue + value . toString ( ) )
1149- }
11501139 return elem . addValue ( value . toString ( ) )
11511140 }
11521141
@@ -1159,9 +1148,6 @@ class WebDriver extends Helper {
11591148 assertElementExists ( res , field , 'Field' )
11601149 const elem = usingFirstElement ( res )
11611150 highlightActiveElement . call ( this , elem )
1162- if ( this . options . automationProtocol ) {
1163- return elem . setValue ( '' )
1164- }
11651151 return elem . clearValue ( getElementId ( elem ) )
11661152 }
11671153
@@ -1231,7 +1217,7 @@ class WebDriver extends Helper {
12311217 const el = usingFirstElement ( res )
12321218
12331219 // Remote Upload (when running Selenium Server)
1234- if ( this . options . remoteFileUpload && ! this . options . automationProtocol ) {
1220+ if ( this . options . remoteFileUpload ) {
12351221 try {
12361222 this . debugSection ( 'File' , 'Uploading file to remote server' )
12371223 file = await this . browser . uploadFile ( file )
@@ -2593,9 +2579,6 @@ class WebDriver extends Helper {
25932579 async switchTo ( locator ) {
25942580 this . browser . isInsideFrame = true
25952581 if ( Number . isInteger ( locator ) ) {
2596- if ( this . options . automationProtocol ) {
2597- return this . browser . switchToFrame ( locator + 1 )
2598- }
25992582 return this . browser . switchToFrame ( locator )
26002583 }
26012584 if ( ! locator ) {
@@ -2741,12 +2724,6 @@ class WebDriver extends Helper {
27412724 * {{> setGeoLocation }}
27422725 */
27432726 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- }
27502727 this . geoLocation = { latitude, longitude }
27512728
27522729 await this . browser . call ( async ( ) => {
@@ -2762,12 +2739,6 @@ class WebDriver extends Helper {
27622739 *
27632740 */
27642741 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- }
27712742 if ( ! this . geoLocation ) return 'No GeoLocation is set!'
27722743 return this . geoLocation
27732744 }
@@ -2818,12 +2789,6 @@ class WebDriver extends Helper {
28182789 * {{> flushNetworkTraffics }}
28192790 */
28202791 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- }
28272792 this . requests = [ ]
28282793 }
28292794
@@ -2834,12 +2799,6 @@ class WebDriver extends Helper {
28342799 * {{> stopRecordingTraffic }}
28352800 */
28362801 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- }
28432802 this . page . removeAllListeners ( 'request' )
28442803 this . recording = false
28452804 }
@@ -2852,12 +2811,6 @@ class WebDriver extends Helper {
28522811 *
28532812 */
28542813 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- }
28612814 this . flushNetworkTraffics ( )
28622815 this . recording = true
28632816 this . recordedAtLeastOnce = true
@@ -2890,12 +2843,6 @@ class WebDriver extends Helper {
28902843 * {{> grabRecordedNetworkTraffics }}
28912844 */
28922845 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- }
28992846 return grabRecordedNetworkTraffics . call ( this )
29002847 }
29012848
@@ -2906,12 +2853,6 @@ class WebDriver extends Helper {
29062853 * {{> seeTraffic }}
29072854 */
29082855 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- }
29152856 await seeTraffic . call ( this , ...arguments )
29162857 }
29172858
@@ -2923,12 +2864,6 @@ class WebDriver extends Helper {
29232864 *
29242865 */
29252866 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- }
29322867 dontSeeTraffic . call ( this , ...arguments )
29332868 }
29342869}
0 commit comments