Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
等待类名为空-Selenium Webdriver-Java_Java_Selenium_Selenium Webdriver_Wait - Fatal编程技术网

等待类名为空-Selenium Webdriver-Java

等待类名为空-Selenium Webdriver-Java,java,selenium,selenium-webdriver,wait,Java,Selenium,Selenium Webdriver,Wait,使用以下代码,显示的当前屏幕的类将=“活动” 在以下情况下,当前显示付款历史屏幕(ui sref=“paymenthistory”) 基本上,我想知道如何说,等待paymentmethods屏幕激活 我想知道怎么说,等待paymentmethods屏幕激活 然后,要求两个条件同时为真: wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("li.active > a[ui-sref=paymentmet

使用以下代码,显示的当前屏幕的类将=“活动”

在以下情况下,当前显示付款历史屏幕(ui sref=“paymenthistory”)

基本上,我想知道如何说,等待paymentmethods屏幕激活

我想知道怎么说,等待paymentmethods屏幕激活

然后,要求两个条件同时为真:

wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("li.active > a[ui-sref=paymentmethods]")));

我假设当您导航到付款历史记录时,页面的URI会更改?为什么不直接使用它呢?我本可以在这个特定的实例中使用URI,但是,我选择了@alecxe提供的逻辑,因为它可以帮助我解决URI无法确定的其他问题。不过,我非常感谢你的意见。这正是我想要的!非常感谢。我只需要在paymentmethods周围添加“”来修改语法。
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("li[class='active']")));
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("li.active > a[ui-sref=paymentmethods]")));