オートコンプリート ベースの検索テキスト フィールドにテキストを入力する際に、webdriver を動作させることができません。次のコードを使用しています。
//here elmt is a WebElement variable.
elmt = driver.findElement(By.id(testDataMap.get("globalSearchTextLocator")));
elmt.sendKeys(patientName);
//Here I am finding the search result list once webdriver enters the characters.
elmt = driver.findElement(By.cssSelector(testDataMap
.get("searchPatientNameLocator")));
searchedPatientsList = driver.findElements(By.cssSelector(testDataMap
.get("searchPatientNameLocator")));
elmt.click()
以前も使ってみelmt.sendKeys()
ました。テストを実行したランダムな数回は機能しました。しかし、ほとんどの場合、失敗します。何が起こるかというと、webdriver が検索フィールドにテキストを入力し、次の瞬間にそれをクリアします。これにより、検索結果が得られず、テストに失敗します。この奇妙な動作の背後にある問題を追跡することはできません。何か助けはありますか?前もって感謝します!