You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using the com.machinepublishers.jbrowserdriver.JBrowserDriver.navigate() API (e.g. for reloading or navigating back), I receive a org.openqa.selenium.NoSuchElementException when trying to work with the WebDriver (e.g. on getPageSource() or findElementsBy…).
Seems that the driver still tries to access the previously loaded page. I did a quick digging through the source code, but couldn't find anything related on first sight. In case somebody can give me a hint where to look, I'd be willing to provide a fix.
Here's a minimal test case which shows the issue:
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.machinepublishers.jbrowserdriver.JBrowserDriver;
public class NavigationIssues {
private JBrowserDriver driver;
@Before
public void before() {
driver = new JBrowserDriver();
}
@After
public void after() {
driver.quit();
driver = null;
}
@Test
public void test_navigateRefresh() {
driver.get("http://example.com");
driver.navigate().refresh();
assertNotNull(driver.getPageSource());
assertEquals(1, driver.findElementsByXPath("//h1").size());
}
@Test
public void test_navigateBack() {
driver.get("http://example.com");
driver.get("http://example.edu");
driver.navigate().back();
assertNotNull(driver.getPageSource());
assertEquals(1, driver.findElementsByXPath("//h1").size());
}
}
The text was updated successfully, but these errors were encountered:
After using the
com.machinepublishers.jbrowserdriver.JBrowserDriver.navigate()
API (e.g. for reloading or navigating back), I receive aorg.openqa.selenium.NoSuchElementException
when trying to work with the WebDriver (e.g. ongetPageSource()
orfindElementsBy…
).Seems that the driver still tries to access the previously loaded page. I did a quick digging through the source code, but couldn't find anything related on first sight. In case somebody can give me a hint where to look, I'd be willing to provide a fix.
Here's a minimal test case which shows the issue:
The text was updated successfully, but these errors were encountered: