返回

显式Webdriver wait Selenium 4.0 Python无法重新格式化代码

发布时间:2022-06-28 03:37:44 423
# node.js

我正在写如何以与 Selenium 4 兼容的方式重新格式化我的代码。

我正在尝试使用 webdriver 等到它通过类名找到元素的可见性。在 Selenium 更新之前,我有一条工作线做了同样的事情,尽管我尝试了很多,但我无法让它工作。以下是曾经工作的代码,以及我尝试修复它的尝试和相应的错误代码:

input = new Vector3(move.ReadValue<Vector2>().x, 0, move.ReadValue<Vector2>().y);

Inputs 是对从我的 Input 资产生成的脚本的引用;

我的脚本:

 WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CLASS_NAME, "class_name")))

我尝试使用Selenium 4,但没有成功:

  WebDriverWait(driver, Duration.ofSeconds(10)).until(visibility_of_element_located(By.CLASS_NAME("class_name")))

我尝试的代码的依赖项

    selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.expected_conditions import visibility_of, visibility_of_element_located
from selenium.webdriver.support.ui import WebDriverWait

我不是python的高级用户,但我正在努力学习。任何帮助都将不胜感激!

非常感谢。

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像