RE: Advise on locating elements when there is a page refresh that happens
Am trying to automate JIRA application create_issue .When create button is clicked , there is page which gets displayed that allows us to select project,issue_type, summary etc and then finally submit .
I observe that when we select a project in the project field and press enter, the page gets refreshed . Now i try to locate the next element which is issue_type but get the below error.
Clicked on create_link
Exception in thread “main” org.openqa.selenium.StaleElementReferenceException: Element not found in the cache – perhaps the page has changed since it was looked up
Command duration or timeout: 10.05 seconds
Could you please help identify what could be the issue ?
Below is the JAVA code
System.out.println(“Clicked on create_link”);
WebElement project = driver.findElement(By.xpath(“.//*[@id=’project-field’]”));
project.sendKeys(“A Test Project”);
WebElement issue = driver.findElement(By.xpath(“.//input[@id=’issuetype-field’]”));
Exception in thread “main” org.openqa.selenium.StaleElementReferenceException: Element not found in the cache // This Exception comes when
Xpath oF Elment has been changed
Webdriver has already Find That Element in Page But Because of Page Refresh The Xpath of Element has been Changed