diff --git a/frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx b/frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx
index 35dbb8380f..15f2f2616d 100644
--- a/frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx
+++ b/frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx
@@ -34,7 +34,7 @@ describe("FileSelector Component", () => {
it("displays the right info for string", async () => {
const { getByText } = render();
const elt = getByText("toto");
- expect(elt.parentElement).toHaveClass("taipy-file-selector");
+ expect(elt.parentElement?.parentElement).toHaveClass("taipy-file-selector");
});
it("displays the default value", async () => {
const { getByText } = render();