html - Selenium inconsistent in finding element with text edited by javascript -


i having trouble verifying presence of webelement. below html code html element.

<div class="notifications top-right" style="right: 310px;"></div>

it div element affected <script> element later once form has been submitted. <div> element popup in top right corner of webpage, display message, , disappear. below javascript accomplishes this.

<script>     $(document).ready(function() {         var message = 'sample text sample text sample text';         $('.notifications.top-right').css('right', $(window).width() - $("#content").width() + 200 + 'px');         $('.notifications.top-right').notify({             message: { text: message },             closeable: false         }).show();     }); </script> 

in java code, click on button, submits form, , taken new page, wait popup appear verify presence, , move on test. however, searching popup inconsistent , succeeds of time. if has ideas on solutions, appreciate it. below selenium code.

public void approve() {     jse.executescript("arguments[0].click()", link_approve());     wait.until(expectedconditions.visibilityof(driver.findelement(by.xpath("//div[contains(text(), ' sample text')]")))); } 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -