Skip to content

Conversation

rapatel0
Copy link
Contributor

The changes enable usage of driver.remote() in selenium for remote execution.

), "Instruction output file must be a YAML or JSON file or None."
assert (
chromedriver_path is not None
(chromedriver_path is not None) or (remote_url is not None)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably have to check if it's one or the other, right?

@handrew
Copy link
Owner

handrew commented Apr 16, 2024

I think it looks mostly good to me, except the one nit on the assertion.

I'll have to test it myself some time—I didn't know you could do this with Selenium!—but otherwise thank you for the contribution and I'll try to merge it quickly.

@rapatel0
Copy link
Contributor Author

rapatel0 commented Apr 16, 2024

Hold up. Keep this in pull. I see a few issues that I'd like to fix before merging

@rapatel0
Copy link
Contributor Author

rapatel0 commented Apr 16, 2024

All good now. Tested with my workflow.

If you guys want to test

Selenium Remote Driver

docker run -d -p 4444:4444 -p 7900:7900 -e SE_NODE_MAX_SESSIONS=8 --shm-size="4g" --name="SEL" selenium/standalone-chrome

Calling the agent

def run_agent(instructions, config_arguements):

    agent = GPTSeleniumAgent(instructions, 
                             remote_url=http://localhost:4444,
                             user_data_dir=config_arguements.user_data_dir,
                             headless=True)
    agent.run()

@rapatel0
Copy link
Contributor Author

rapatel0 commented Apr 17, 2024

I'll have to test it myself some time—I didn't know you could do this with Selenium!—but otherwise thank you for the contribution and I'll try to merge it quickly.

Yeah maintaining selenium, chrome, and chromedriver is a pain. This is easier to just fireoff and run from a remote location.

Would appreciate a merge soonish to simplify my package mangement

@handrew
Copy link
Owner

handrew commented Apr 18, 2024

Taking a look now.

@handrew
Copy link
Owner

handrew commented Apr 18, 2024

All good now. Tested with my workflow.

If you guys want to test

Selenium Remote Driver

docker run -d -p 4444:4444 -p 7900:7900 -e SE_NODE_MAX_SESSIONS=8 --shm-size="4g" --name="SEL" selenium/standalone-chrome

Calling the agent

def run_agent(instructions, config_arguements):

    agent = GPTSeleniumAgent(instructions, 
                             remote_url=http://localhost:4444,
                             user_data_dir=config_arguements.user_data_dir,
                             headless=True)
    agent.run()

Hey @rapatel0 I tried this and got the following error: selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: cannot create default profile directory.

Once I can replicate it working then I'll merge and update the package.

EDIT: Ah, I think it's because the docker container did not work. It can't detect my platform (linux/arm64/v8). Will keep trying...

EDIT2: Fixed this using the seleniarm distribution. Now getting this error, if you can help: selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: cannot create default profile directory

EDIT3: This link helped.

@handrew handrew merged commit 634b696 into handrew:main Apr 18, 2024
@handrew
Copy link
Owner

handrew commented Apr 18, 2024

Thanks @rapatel0, just updated the package. 0.2.51. Appreciate the update, this was cool to try out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants