In my search page I have a list with an input box and a 'go' button. The value is received, but I want to iterate the list and enter the text in the input box (text is static) Every time when this list is selected, instead of pressing the 'go' button it automatically searches < / P> Now for the first time in the list, select the "State" which passes it to the second loop and selects the list item. Once selected, the page reloads. Then there is an error message: This is expected to behave completely, since DOM is completely built on the page, Elements will be invalid after reference page refresh. WebElement search_list = driver.findElement (By.xpath ("// * [@ id = 'tl_t place']"))); List & lt; WebElement & gt; Li = search_list.find Elements (By.tagName ("Options")); (Int i = 0; i & lt; li.size (); i ++) {System.out.println (li.get (i) .click ()); Try {driver.findElement (By.xpath ("// * @ id = 'cmain_Place']")))). SendKeys ("text");
Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: element in the cache was not found - perhaps the page has changed because it was viewed
Comments
Post a Comment