gpt4 book ai didi

Selenium 网络驱动程序 : cssselector

转载 作者:行者123 更新时间:2023-12-02 17:14:56 24 4
gpt4 key购买 nike

我正在尝试登录 this 。在其中单击“登录”,我已成功完成此操作。现在,当尝试使用 Xpath 输入用户名/密码时,它会显示异常,其中显示

Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: element not visible

代码是:-

driver.findElement(By.xpath(".//*[@id='load_form']/fieldset[1]/input")).sendKeys("test123");
driver.findElement(By.xpath(".//*[@id='load_form']/fieldset[2]/input")).sendKeys("test123");

我知道这个XpathSignUp表单中使用的相同,那么定位这两个字段的其他方法是什么?我们如何通过cssselector来使用它?感谢您提前提供的帮助。

最佳答案

通过查找相对 xpath 上升一级

//div[@id='login']/form[@id='load_form']//input[@name='username']
//div[@id='login']/form[@id='load_form']//input[@name='password']

关于 Selenium 网络驱动程序 : cssselector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38326303/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com