我正在使用Selenium和Web驅動程序。Selenium:如何定位通知消息等動態元素
我有一個表格可以裝在燈箱裏。現在,當我點擊「提交」。該燈箱被關閉,並在頁面頂部生成一個簡單的通知,幾秒後消失。現在
我的問題是:當我做
driver.findElement(By.xpath(".//*[@id='createCaseBtn']")).click(); // x-path of submit button
我應如何檢查的通知消息是否出現在UI。
因爲當我做
driver.findElement(By.xpath(".//*[@id='easyNotification']")).getText(); // x-path of easyNotification message
我表明我,這是無法找到這似乎邏輯上是正確的元素,因爲在那個時候通知消息是不存在的UI。只有在完成AJAX請求(用於表單的子映射)之後,該消息纔會出現在UI上。
請幫忙!!!!
謝謝