I want to zoom in and out my browser using webdriverio can anyone help on this

617 views Asked by At

This code is not working for me

describe("Zoom in and zoom out using keyboard", function () {
  it("Should open the application main page ", async function () {
    await browser.url("https://the-internet.herokuapp.com/key_presses");
    await browser.keys(["Control", "-"]);
    await browser.keys(["Control", "-"]);
    // await browser.keys('Control')
    // await browser.keys('-');
    //  await browser.keys('Control')
    //await browser.keys('-');
    await browser.maximizeWindow();
    const search = $("//input[@id='target']");
    await search.click();
    await browser.pause(5000);
    await browser.saveScreenshot("./screenshots/keypress.png");
    //browser.pause(5000)
  });
});

Can any one give my the correct code

1

There are 1 answers

0
Nandan N On
await browser.execute(() => {

    document.body.style.zoom = `70%`; // Adjust the percentage as per your requirement

  });