WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED MOVED
216479
SafariDriver throws NoSuchElementException attempting to find child of element reference that's gone stale
https://bugs.webkit.org/show_bug.cgi?id=216479
Summary
SafariDriver throws NoSuchElementException attempting to find child of elemen...
Scott Babcock
Reported
2020-09-14 07:01:42 PDT
## 🐛 Bug Report SCENARIO: Invoke the `findElement` method of an element reference that's gone stale EXPECT: StaleElementReferenceException ACTUAL: NoSuchElementException ## To Reproduce Detailed steps to reproduce the behavior: * Acquire a reference to an element that has children * Refresh the browser session * Search for a child of the element reference With the Java code below: * [getTagName] throws `StaleElementReferenceException` * [findElement] throws `NoSuchElementException` ## Expected behavior This should produce `StaleElementReferenceException` ## Actual behavior **SafariDriver** throws `NoSuchElementException` ## Test script or set of commands reproducing this issue ```java package com.nordstrom.automation.selenium.model; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; import org.openqa.selenium.safari.SafariDriver; public class SafariStale { private WebDriver driver; @Before public void before() { driver = new SafariDriver(); } @Test public void testStale() { driver.get("
https://www.w3schools.com/html/html_tables.asp
"); WebElement table = driver.findElement(By.cssSelector("table#customers")); table.getTagName(); table.findElement(By.cssSelector("tr")); driver.navigate().refresh(); try { table.getTagName(); } catch (WebDriverException e) { System.out.printf("[getTagName] throws %s\n", e.getClass().getSimpleName()); } try { table.findElement(By.cssSelector("tr")); } catch (WebDriverException e) { System.out.printf("[findElement] throws %s\n", e.getClass().getSimpleName()); } } @After public void after() { driver.quit(); } } ``` ## Environment OS: MacOS 10.15.4 Browser: Safari Browser version: 13.1 (15609.1.20.111.8) Browser Driver version: Included with Safari 13.1 (15609.1.20.111.8) Language Bindings version: 3.141.59
Attachments
Add attachment
proposed patch, testcase, etc.
Scott Babcock
Comment 1
2020-09-14 07:04:42 PDT
Migrated from
https://github.com/SeleniumHQ/selenium/issues/8376
In my original code, I called each method before and after the `refresh`. Prior to refreshing the session, `getTagName` returns "table" and `findElement` returns the child "tr" element. I revised the repro code to include these happy-path method calls. Other drivers I've tried (ChromeDriver, FirefoxDriver, HtmlUnitDriver, GhostDriver) all exhibit the expected behavior. This is definitely a bug in SafariDriver, or perhaps in Safari itself.
Radar WebKit Bug Importer
Comment 2
2020-09-21 12:15:47 PDT
<
rdar://problem/69319181
>
Blaze Burg
Comment 3
2020-09-21 14:01:59 PDT
Thanks for the very clear report. I'll take a look at this.
Brent Fulgham
Comment 4
2022-02-10 21:45:17 PST
The fix for this issue was needed outside the WebKit project, therefore this is being resolved as 'Moved'. This should now be fixed in current macOS 12.3 betas.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug