Skip to content

Fix element not found error#169

Open
wout wants to merge 4 commits intoluckyframework:mainfrom
wout:fix-element-not-found-error
Open

Fix element not found error#169
wout wants to merge 4 commits intoluckyframework:mainfrom
wout:fix-element-not-found-error

Conversation

@wout
Copy link
Copy Markdown
Contributor

@wout wout commented Apr 23, 2026

In reply to: luckyframework/lucky_cli#883 (comment)

This PR includes two tweaks.

1. Increase retry timeout

I bumped it from 1 to 3 seconds so there's just a bit more time for everything to become alive, without too much impact.

2. Ensure readyState check happens in a new document

The readyState check I added before was only partially effective because readyState === 'complete' could still be true for the previous page right after a navigate_to.
Now, before each visit a marker is set on the previous page's window. After navigating we wait until both the marker is gone and readyState === 'complete'.

I also added a small note in the README on how to test on non-US systems. Always had one test failing because of a date formatting mismatch.

@jwoertink
Copy link
Copy Markdown
Member

Sweet! Thanks for the fix.

Always had one test failing because of a date formatting mismatch.

Is there a date somewhere we should be changing to a more standard format?

@wout
Copy link
Copy Markdown
Contributor Author

wout commented Apr 23, 2026

Is there a date somewhere we should be changing to a more standard format?

I think it's just a locale issue in the browser. This is the error:


Failures:

  1) LuckyFlow submits dates appropriately
     Failure/Error: flow.should have_element("@result", text: "custom_date=2016-02-15")

       Expected to find element on page, but it was not found.
       
         ▸ looking for: [flow-id='result']
         ▸ with text: custom_date=2016-02-15

     # spec/lucky_flow_spec.cr:186

Finished in 6.53 seconds
43 examples, 1 failures, 0 errors, 0 pending

Failed examples:

crystal spec spec/lucky_flow_spec.cr:170 # LuckyFlow submits dates appropriately

It's because of this weird US date formatting (mm/dd/yyyy) 😄, so flow.fill tries to set the month to 15 on non-US systems.

But you make a good point, perhaps we can pass the flag higher up. I'll have a look.

@wout
Copy link
Copy Markdown
Contributor Author

wout commented Apr 23, 2026

This works now without the flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants