gpt4 book ai didi

java - NUllPointerException 元素 webdriver

转载 作者:太空宇宙 更新时间:2023-11-04 11:05:48 27 4
gpt4 key购买 nike

public WebElement waitFindElement(By by) {
WebDriverWait wait = new WebDriverWait(driver, 5000);
wait.until( ExpectedConditions.presenceOfElementLocated(by));
return driver.findElement(by);
}

public void clickOrigem() {
driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.MINUTES);
WebElement opcaoOrigem = util.waitFindElement(By.xpath(".//*[text()='Sua empresa']"));
openSite.highlightElement(opcaoOrigem);
opcaoOrigem.click();
}

public void clickSubMenuContas() {
pagPrincipal.clickOrigem();
}

我找不到该元素,它给出了NullPointerException

最佳答案

尝试下面的xpath

//*[text()[contains(.,'Sua   empresa')]]

还要检查两个单词之间的空格数。

关于java - NUllPointerException 元素 webdriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46495136/

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