gpt4 book ai didi

java - 我执行了 selenium 代码,但出现错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:30:36 24 4
gpt4 key购买 nike

使用此脚本但出现错误消息。

WebElement elecounty = (driver.findElement(By.xpath("//div[@class='select_county']//span[text()='select'] ")));
//Thread.sleep(5000);
elecounty.click();Thread.sleep(5000);
elecounty.sendKeys("Baker");

错误信息:

element not interactable
(Session info: chrome=75.0.3770.142)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'NAV-L186', ip: '192.168.0.186', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_212'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 75.0.3770.142, chrome: {chromedriverVersion: 75.0.3770.90 (a6dcaf7e3ec6f..., userDataDir: ...}, goog:chromeOptions: {debuggerAddress: localhost:58326}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: d287681e8c023df5adc766bffc9d5b15

最佳答案

抛出 ElementNotInteractableException 表示尽管元素存在于 HTML DOM 中,但它不处于可以与之交互的状态。

您应该将 WebDriverWait ExpectedCondition.elementToBeClickable 一起使用:

WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement elecounty = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='select_county']//span[text()='select']")));
elecounty.click();

关于java - 我执行了 selenium 代码,但出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57266834/

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