使用playwright截图Kibana图表

安装 playwright

pip install playwright

安装 playwright 依赖项

playwright install --with-deps

使用playwright自动生成代码

使用playwright 生成访问kibana dashboard 代码,其中--ignore-https-errors为忽略证书认证

playwright codegen --ignore-https-errors "https://kibana.liujinye.example/"

上面命令执行完会自动调用 chromium ,并生成python 代码,如图:

image-20231221190033724

自动生成代码示例如下:

在生成好的代码基础上增加一些其它逻辑

Dockerfile示例

参考

https://playwright.dev/docs/api/class-page#page-goto

https://developer.aliyun.com/article/835305

Last updated