.setDeviceDimensions() 建議編輯
自:2.2.0覆寫裝置模式/尺寸。不帶任何參數呼叫以將裝置尺寸重置回原始值。
用法
.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 選填 |
函式 | 指令完成時要呼叫的回呼函式。 |