Quantcast
Channel: Node Development - KNIME Community Forum
Viewing all articles
Browse latest Browse all 81

Python Node Development

$
0
0

Hello KNIMErs!

I would like to use the ConnectionPortObject to pass my BrowserSession onto another node.
I tried many ways to implement my output port but seem to get nowhere.

As of right now I use this code to implement my output port:

class StarterNode(knext.PythonNode):
def __init__(self):
        self.output_ports = [
            knext.Port(
                type=ConnectionPortObject,
                name="Browser Session",
                description="Browser"
            )
            ]

To pass my data i tried to use

 def execute(self, exec_context):
       
       
        match self.browser_selection.driverSelection:

            case "Chrome":
                driver = chrome_window()
                driver.get(self.browser_configuration.urlSelection)

            case "Edge":
                driver = edge_window()
                driver.get(self.browser_configuration.urlSelection)

            case "Firefox":
                driver = firefox_window()
                driver.get(self.browser_configuration.urlSelection)

        
        
        return knext.ConnectionPortObject

I get the following error message: “Execute failed: type object ‘ConnectionPortObject’ has no attribute ‘id’”
Although i tried to add an ID, I get the same message.

I know I have to pass my “driver” - data, but I cannot find a solution.

Different AI suggested to implement a class like:

class BrowserSessionObject(ConnectionPortObjects)...

… but that got me nowhere as well.

What am I missing here?

Thank you in advance!

Screenshot 2024-08-19 133156

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 81

Trending Articles