I have a problem with the “find element” node in the Selenium package.
I would like to retrieve the addresses contained in the two following pages:
I made a loop. The addresses are contained in the class = “affiliation” of the html page.
In the “Find element” node, I used the css selector “.affiliation”.
But this one, does not always return the value or is in error. If I launch the loop it is in error or does not return a value. However, I manage to recover the value individually from time to time.
Does the problem come from the page you have to click to see the address?
If someone has an idea.
Thank you for your help
Test.knwf (17.0 KB)
did you have a look at the “Wait” functionality in the Find Elements node? This way, execution will wait until the element appears (some elements might be added to the page dynamically after it has loaded)
Wait for X seconds maximum, poll every Y ms
Specify the maximum amount of time in seconds to wait in case elements are searched and are not immediately available. Additionally, the poll interval in milliseconds can be specified. Selenium will wait at most for the given amount of time and keep checking in the given poll interval.
If this does not help: Can you share a reduced example workflow here?
thank you for your answer and your help. I have changed the waiting time and the poll interval in the “Find Elements” node. But no improvement. I share my reduced workflow with you.
Test.knwf (17.0 KB)
thanks for the example, that really helps to understand your issue. The main point which is currently missing: You need to explicitly click the “Show More”:
You will only get the
.affiliation after the section has expanded on the page.
So I inserted another “Find Elements” node to extract the “Show More” button followed by a “Click” node. This unfortunately did not work. The reason: The page seems to do a “re-layout” (custom fonts are loaded after the initial page load, which causes the elements on the page to shift their positions) – thus the “Click” node will click into emptiness. Bummer!
Two ideas how to solve this:
- (simple) Place a “Wait” node before doing the click, to ensure that the “Show More” element is already at its final position:
- (advanced) Use a loop which continuously clicks the element, followed by a “Find Elements” trying to extract the
.affiliation. When it could be extracted successfully, break the loop.
Does this help?
Thank you very much for your help and your ideas. I will test your modified workflow.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.