Selenium : Problem "Find Element" node

Hello everybody,

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:

  1. https://www.sciencedirect.com/science/article/pii/S0960852414015053
  2. https://www.sciencedirect.com/science/article/pii/S1385894716314462

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

Best regards,

Chris
Test.knwf (17.0 KB)

Hi Chris,

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?

–Philipp

1 Like

Hi Philip,

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.

the file

Test.knwf (17.0 KB)

Thanks,

Best regards,

Chris

1 Like

Hi Chris,

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”:

image

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:

  1. (simple) Place a “Wait” node before doing the click, to ensure that the “Show More” element is already at its final position:
  1. (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?

–Philipp

1 Like

Hi Phillip,

Thank you very much for your help and your ideas. I will test your modified workflow.

Best regards,

Chris

1 Like