Java 硒化物不';找不到Web元素

Java 硒化物不';找不到Web元素,java,selenide,Java,Selenide,有人能帮助理解通过硒化物搜索元素的错误吗 我有这样的HTML代码: <div> Current method: <strong> SMS </strong> </div> 但是Selenide使用相同的定位器返回ElementNotFound异常 $(By.xpath("//div[contains(. , \"Current method\")]/strong")) 您可以尝试: $(byText("Current me

有人能帮助理解通过硒化物搜索元素的错误吗

我有这样的HTML代码:

<div>
  Current method: 
  <strong>
    SMS
  </strong>
</div>
但是Selenide使用相同的定位器返回ElementNotFound异常

$(By.xpath("//div[contains(. , \"Current method\")]/strong"))
您可以尝试:

$(byText("Current method:")).shouldBe(Condition.exist);
您可以尝试:

$(byText("Current method:")).shouldBe(Condition.exist);

如果你需要强壮,你可以

   $(By.xpath("//strong[contains(text(),'SMS')]"))

如果你需要强壮,你可以

   $(By.xpath("//strong[contains(text(),'SMS')]"))
使用硒-> findElement(By.xpath(“//div[contains(text(),'Current method'))]/strong”)

使用硒化物-> $(By.xpath(“//div[contains(text(),'Current method')]/strong”)

这两种方法既可用于硒,也可用于硒化物。这两种方法并不特定于硒或硒化物

使用硒-> findElement(By.xpath(“//div[contains(text(),'Current method'))]/strong”)

使用硒化物-> $(By.xpath(“//div[contains(text(),'Current method')]/strong”)


这两种方法可用于硒和硒化物。方法不特定于硒或硒化物

您可以使用以下选项。
$(“强:包含('SMS')”)<代码>使用css选择器方法

您可以使用以下选项。 $(“强:包含('SMS')”)<代码>使用css选择器方法