私はセレンのコードを実行しますが、エラーが表示されています

zafarアフマド:

このスクリプトが、エラーメッセージが表示されますを使用します。

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内で存在するが、それはと相互作用することが可能な状態であることを示すためにスローされます。

あなたは使うべきWebDriverWaitExpectedCondition.elementToBeClickable

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

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=230776&siteId=1