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
{{ message }}
Repository navigation
We noticed regressions and inconsistencies after migrating from 0.18.1 to 0.19.0 #1138
and the weird thing is that some checks still work as they were working with 0.18.1 while some others give us a mix of these issues:
the same document which can be parsed with 0.18.1 now with 0.19.0 needs a time.sleep(1) (or even longer) otherwise the document isn't ready
it seems that the wait_time parameter is completely ignored: if we use a breakpoint() and debug the code step by step, everything works fine because by running it step by step we manually introduce slowness and by the time we run the next line of code, the element is ready to be parsed.
Considering that we haven't done any other change to our code (the initial PR was made by Dependabot which just bumped the dependency number and I only changed the syntax by following the warning message) we can't really understand why the same code doesn't work anymore.
Are you aware of any similar regression or do you know if there is something we should do to make sure the document is fully loaded before we try to access any of its elements?
When you say the wait_time parameter is ignored, have you observed this with your eyes? Does nothing happen for 30 seconds or does the script appear to continue?
The implementation of is_element_visible_by_xpath applied the wait_time argument to both the find element operation and the visibility check. find_by_xpath().is_visible(30) will only apply the wait_time to the visibility check. This behaviour is correct but wasn't documented. This may be the source of your issues.
You can use the wait_time argument with find_by_<x> methods or apply it at the Browser level. This is undocumented at the moment but should be in the future.
When you say the wait_time parameter is ignored, have you observed this with your eyes? Does nothing happen for 30 seconds or does the script appear to continue?
the script appears to continue. It doesn't wait for the element to be available, but it immediately spits errors like ElementNotFound or "the element has been removed from the DOM" etc...
I can provide more information and additional debugging information on Monday when I'm back to work.
The implementation of is_element_visible_by_xpath applied the wait_time argument to both the find element operation and the visibility check. find_by_xpath().is_visible(30) will only apply the wait_time to the visibility check. This behaviour is correct but wasn't documented. This may be the source of your issues.
You can use the wait_time argument with find_by_<x> methods or apply it at the Browser level. This is undocumented at the moment but should be in the future.
we tried that too (yes, I confirm the documentation is not updated but we dug into the source code to find out) but it didn't help. I will collect more information in the next days, thanks again.
@jsfehler hi, I finally had the possibility to do some tests and I tried to do what you said (add the wait_time parameter to each call), but it still doesn't work.
Our code does the following checks (they may be redundant, possibly, but they were working with 0.18.1):
If I put a breakpoint() at the beginning and then I continue the execution by pressing c (so in this way I introduce a bit of lag and give it time to load the page), everything works as expected.
I think I might have a related issue I've been seeing. If unrelated, I can open up a separate one.
I have some tests which are hanging and waiting indefinitely whenever the element cannot be found. This happens if I'm writing a test first, before I've actually implemented the feature.
I would expect the row_1_text = row_1.find_by_tag('td')[5].text line to throw an error because the table does not have a column at that index yet. Once I add that column, the test passes. I have tried adding a wait_time to the find_by_tag call and I have also configured the browser with a wait_time of 1 second: Browser('chrome', config=config, wait_time=1).
Has anyone encountered this issue with the wait_time not being respected?
@andreagrandi Apologies for the extremely late answer: The ElementNotInteractableException error is an issue with your test. You can't fill an input if it's not interactable. It's difficult to triage this without access to the application you're testing, but it's not a splinter/selenium issue. Visibility and interactive states are different. If I had to guess, there's some async behaviour happening where an element is technically visible before it's interactable.
However, I've fixed the issue where you were getting ElementDoesNotExist errors. The new logic in the is_visible() and is_not_visible() methods did not account for the element being removed after the element was first found. #1277 handles this. I'm making an assumption here, but if your application is removing and adding elements then you would have encountered this issue.
Activity
jsfehler commentedon Feb 3, 2023
When you say the wait_time parameter is ignored, have you observed this with your eyes? Does nothing happen for 30 seconds or does the script appear to continue?
jsfehler commentedon Feb 3, 2023
The implementation of
is_element_visible_by_xpathapplied the wait_time argument to both the find element operation and the visibility check.find_by_xpath().is_visible(30)will only apply the wait_time to the visibility check. This behaviour is correct but wasn't documented. This may be the source of your issues.You can use the wait_time argument with
find_by_<x>methods or apply it at the Browser level. This is undocumented at the moment but should be in the future.andreagrandi commentedon Feb 4, 2023
the script appears to continue. It doesn't wait for the element to be available, but it immediately spits errors like
ElementNotFoundor "the element has been removed from the DOM" etc...I can provide more information and additional debugging information on Monday when I'm back to work.
Thanks for your reply in the mean time 🙏
andreagrandi commentedon Feb 4, 2023
we tried that too (yes, I confirm the documentation is not updated but we dug into the source code to find out) but it didn't help. I will collect more information in the next days, thanks again.
andreagrandi commentedon Feb 6, 2023
@jsfehler hi, I finally had the possibility to do some tests and I tried to do what you said (add the
wait_timeparameter to each call), but it still doesn't work.Our code does the following checks (they may be redundant, possibly, but they were working with 0.18.1):
If I put a
breakpoint()at the beginning and then I continue the execution by pressingc(so in this way I introduce a bit of lag and give it time to load the page), everything works as expected.If I remove the
breakpoint()I get this error:p.s: when you say "or apply it at the Browser level" (regarding
wait_time), how does it work? Do you have any example I check? Thanksandreagrandi commentedon Feb 22, 2023
@jsfehler hi, sorry to bother you, I was wondering if there were any updates on your side for the above issue. Thanks 🙏
nburt commentedon May 22, 2024
I think I might have a related issue I've been seeing. If unrelated, I can open up a separate one.
I have some tests which are hanging and waiting indefinitely whenever the element cannot be found. This happens if I'm writing a test first, before I've actually implemented the feature.
For example:
Printed in the console before the test hangs:
I would expect the
row_1_text = row_1.find_by_tag('td')[5].textline to throw an error because the table does not have a column at that index yet. Once I add that column, the test passes. I have tried adding a wait_time to the find_by_tag call and I have also configured the browser with a wait_time of 1 second:Browser('chrome', config=config, wait_time=1).Has anyone encountered this issue with the wait_time not being respected?
jsfehler commentedon May 24, 2024
@andreagrandi Apologies for the extremely late answer: The
ElementNotInteractableExceptionerror is an issue with your test. You can't fill an input if it's not interactable. It's difficult to triage this without access to the application you're testing, but it's not a splinter/selenium issue. Visibility and interactive states are different. If I had to guess, there's some async behaviour happening where an element is technically visible before it's interactable.However, I've fixed the issue where you were getting
ElementDoesNotExisterrors. The new logic in theis_visible()andis_not_visible()methods did not account for the element being removed after the element was first found. #1277 handles this. I'm making an assumption here, but if your application is removing and adding elements then you would have encountered this issue.jsfehler commentedon May 24, 2024
@nburt This sounds like a separate issue. We'll also need a traceback to see the error message your code is throwing.