デバイスモード/寸法を上書きします。引数なしで呼び出すと、デバイスの寸法が元の状態にリセットされます。

使用方法

                    .setDeviceDimensions({width, height, deviceScaleFactor, mobile}, [callback])
                

 describe('modify device dimensions', function() {
   it('modifies the device dimensions and then resets it', function() {
     browser
       .setDeviceDimensions({
         width: 400,
         height: 600,
         deviceScaleFactor: 50,
         mobile: true
       })
       .navigateTo('https://www.google.com')
       .pause(1000)
       .setDeviceDimensions()  // resets the device dimensions
       .navigateTo('https://www.google.com')
       .pause(1000);
   });
 });

パラメータ

名前 説明
metrics
オプション
オブジェクト

設定するデバイスのメトリクス。設定されていない場合は、元のメトリクスが使用されます。

callback
オプション
関数

コマンドが完了したときに呼び出されるコールバック関数。