V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
nextone
V2EX  ›  程序员

playwright 问题, page.is_visible()废弃了

  •  
  •   nextone · 2023-05-02 11:00:19 +08:00 · 1225 次点击
    这是一个创建于 366 天前的主题,其中的信息可能已经有所发展或是发生改变。

    page.is_visible()废弃了,现在如果我想要判断一个元素出现时返回 True ,超时未出现返回 False ,该怎么做呢?不想要自定义函数。

    rimworld
        1
    rimworld  
       2023-05-02 11:51:18 +08:00
    nextone
        2
    nextone  
    OP
       2023-05-02 15:01:19 +08:00
    文档里 locator.is_visible()也弃用了
    ymcyyf
        3
    ymcyyf  
       2023-05-02 19:12:14 +08:00
    https://playwright.dev/python/docs/api/class-locator#locator-wait-for
    可以用 locator.wait_for() ?返回值自己处理下就好
    shayang888
        4
    shayang888  
       2023-05-03 19:27:44 +08:00
    元素方法里有 wait_XXX 方法用这个 如果不行 就用等待时间
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   773 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:36 · PVG 04:36 · LAX 13:36 · JFK 16:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.