【问题标题】:Is it possible to click the back button in the browser using Playwright?是否可以使用 Playwright 在浏览器中单击后退按钮?
【发布时间】:2022-11-03 23:43:38
【问题描述】:

嘿,所以在浏览器中有 <- 可以返回上一页, 和 -> 继续前进。 这些按钮可以通过剧作家点击吗? 他们没有元素,所以我想知道这是否可以使用打字稿。

非常感谢

await navigationObject(page).backButton.click();

【问题讨论】:

    标签: javascript typescript automated-tests playwright-test


    【解决方案1】:

    尝试历史 API:

    window.history.back()
    

    window.history.forward()
    

    见:https://developer.mozilla.org/en-US/docs/Web/API/History_API

    【讨论】:

      猜你喜欢
      • 2011-10-15
      • 2010-09-14
      • 1970-01-01
      • 2013-08-11
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多