Code :
// desktop : width:1920 , height : 1080
const puppeteerVar = require('puppeteer');
describe('Device Emulation using puppeteer ',() =(greather than) {
let browser
let page
before(async function(){
browser = await puppeteerVar.launch({headless: false, slowMo:50})
page = await browser.newPage()
await page.goto("C:/Users/Azhar/Desktop/Puppeteer%20Project/webPage.html")
})
after(async function(){
await browser.close();
})
it('Test Desktop View',async function(){
await page.setViewport({width:1920 , height:1080})
await page.waitForTimeout(6000);
})
it('Test Ipad View',async function(){
const ipad = puppeteerVar.devices['iPad landscape']
await page.emulate(ipad)
await page.waitForTimeout(6000);
})
it('Test Mobile View',async function(){
const mobile = puppeteerVar.devices['iPhone X']
await page.emulate(mobile)
await page.waitForTimeout(6000);
})
})
Next Steps :
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists
► 1. Javascript - [ Ссылка ]
► 2. Puppetter - [ Ссылка ]
► 3. Cypress - [ Ссылка ]
► 4. Tech works - [ Ссылка ]
► 5. Vbscript Basics To Advanced - [ Ссылка ]
► 6. Jmeter - [ Ссылка ]
► 7. Excel - [ Ссылка ]
► 8. Appium - [ Ссылка ]
► 9. Shares - [ Ссылка ]
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
#deviceEmulators
#ipad
#iphone
Ещё видео!