I can't locate "sign-in" button

I’ve inspected topic you sent. But It has a Javascript coding part. I know Selenium WebDriver and can locate via Javascript methods. But I couldn’t find anywhere to typing Javascript codes in KNIME.

As I see that KNIME is whole nodes.

Are there anywhere to type Java/Javascript codes in KNIME. (like an IDE)
Working with code, can be more simply for me.

Thanks.

You can use this node to execute JS which would usually run in the browser:

–Philipp

PS: As a side node (though not really relevant here): You can even execute Java code to access the full Selenium API. This is possible with the regular KNIME Java Snippet node. You can double click on a WebDriver or WebElement input in the node configuration, access their Java API just as in code using the Selenium library, and also return WebDriver resp. WebElement values. A simple example how to achieve this is available e.g. here:

2 Likes

I did what you adviced, thank you so much.
But I couldn’t locate shadow root element unfortunately :roll_eyes:
Find elements node is empty , I can’t locate “Sign-in” element to inside.


Image is above from inside of JS Execute Node

What can I do?
So simple point but I can’t proceed.
I appricate for everything

You’ll need to select the proper input argument (one of the entries with the mouse cursor icon, which represent WebElements) in the left column using a checkbox.

The selected items will be assigned to the arguments array in the JS code.

Hope this helps!

[edit] Also make sure to select the proper return type in the lower left corner - as you’re returning a WebElement chose this in the “Return type” menu.

I see you.
My real problem is that;
I couldn’t assign my element into input arguments(on th left side).

I need to locate "shadow root " element and add the list.

Afterthat I can apply JS execute.

You can do that using a Find Elements node, where you select the shadow DOM container - in your case this is obviously that ep-button element. Extract that element before the Execute JavaScript node and then select it as input.

Or instead, query for the shadow DOM container directly via JS code. Instead of …

const shadowDomContainer = arguments[0];

… do something like …

const shadowDomContainer = document.querySelector('ep-button');

If this doesn’t work, please attach the current version of your workflow, this makes it easier to help and for others to jump in.

1 Like

It didn’t
Bbecause, KNIME Selenium Nodes can’t see any shadow DOM.
So it doesn’t locate any element, because of that can’t click “Sign in” button.

Would you please attach the workflow as file (i.e. .knwf)

Sure;

cars.com_extract_list.knwf (24.2 KB)

This is my workflow .

Thank you - the DOM contains a nested shadow DOM, i.e. a shadow DOM within a shadow DOM. You’ll notice this if you carefully inspect the page structure from the button “upwards”.

Thus you’ll need to adapt the code to query twice into the shadow root:

const outerShadowDomContainer = document.querySelector('cars-auth-modal');

const innerShadowDomContainer = outerShadowDomContainer.shadowRoot.querySelector('ep-button[type="submit"]');

const submitButton = innerShadowDomContainer.shadowRoot.querySelector('button[type="submit"]');

// result will be the retrieved WebElement
return submitButton;

After the Execute JavaScript node you can then put a Click node and the login will work.

1 Like

Hi @qqilihq ;

I’m doing what you say but it doesn’t.

Please Could you share with me as a workflow file you did and works.

I so thank you

@Sezgin I uploaded the workflow to my NodePit Space for you:

1 Like

I know taht , You’re so tired from my questions.
So sorry for that. But it doesn’t your workflow my PC.

Is it working on your PC?

Yes, it works fine for me.

The shown error message is quite common with Selenium and I think we also discussed it here already in the forum once.

Essentially, make sure that the button which you’re trying to click is visible in the window: (a) browser window should be big enough or you need to scroll the button into the view, and/or (b) window should not be obscured by other overlays (such as cookie ), etc.

1 Like

I see;
My Problem is most probably "SMALL WINDOW;
I couldn’t any settings for maximize window.
Where is the settings for maximize window

There’s a Window node for that:

1 Like

I did it. but didn’t click.
I will apply Your other advice (scroll down)
Where is the scroll node?

Please search in the forum for selenium scroll – it’ll give you several ideas.

Yes you’re right.

Mine is in the popup.

I should find the scroll the page code in JS executer in popup.

You are perfect man. Thank you for all your help. I’m appreciate to you

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.